
obj/user/pingpong.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 93 00 00 00       	call   8000c4 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

#include <inc/lib.h>

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	57                   	push   %edi
  80003b:	56                   	push   %esi
  80003c:	53                   	push   %ebx
  80003d:	83 ec 1c             	sub    $0x1c,%esp
	envid_t who;

	if ((who = fork()) != 0) {
  800040:	e8 e0 0e 00 00       	call   800f25 <fork>
  800045:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800048:	85 c0                	test   %eax,%eax
  80004a:	75 4f                	jne    80009b <umain+0x68>
		cprintf("send 0 from %x to %x\n", sys_getenvid(), who);
		ipc_send(who, 0, 0, 0);
	}

	while (1) {
		uint32_t i = ipc_recv(&who, 0, 0);
  80004c:	8d 75 e4             	lea    -0x1c(%ebp),%esi
  80004f:	83 ec 04             	sub    $0x4,%esp
  800052:	6a 00                	push   $0x0
  800054:	6a 00                	push   $0x0
  800056:	56                   	push   %esi
  800057:	e8 e4 10 00 00       	call   801140 <ipc_recv>
  80005c:	89 c3                	mov    %eax,%ebx
		cprintf("%x got %d from %x\n", sys_getenvid(), i, who);
  80005e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  800061:	e8 42 0b 00 00       	call   800ba8 <sys_getenvid>
  800066:	57                   	push   %edi
  800067:	53                   	push   %ebx
  800068:	50                   	push   %eax
  800069:	68 56 23 80 00       	push   $0x802356
  80006e:	e8 60 01 00 00       	call   8001d3 <cprintf>
		if (i == 10)
  800073:	83 c4 20             	add    $0x20,%esp
  800076:	83 fb 0a             	cmp    $0xa,%ebx
  800079:	74 18                	je     800093 <umain+0x60>
			return;
		i++;
  80007b:	83 c3 01             	add    $0x1,%ebx
		ipc_send(who, i, 0, 0);
  80007e:	6a 00                	push   $0x0
  800080:	6a 00                	push   $0x0
  800082:	53                   	push   %ebx
  800083:	ff 75 e4             	pushl  -0x1c(%ebp)
  800086:	e8 36 11 00 00       	call   8011c1 <ipc_send>
		if (i == 10)
  80008b:	83 c4 10             	add    $0x10,%esp
  80008e:	83 fb 0a             	cmp    $0xa,%ebx
  800091:	75 bc                	jne    80004f <umain+0x1c>
			return;
	}

}
  800093:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800096:	5b                   	pop    %ebx
  800097:	5e                   	pop    %esi
  800098:	5f                   	pop    %edi
  800099:	5d                   	pop    %ebp
  80009a:	c3                   	ret    
  80009b:	89 c3                	mov    %eax,%ebx
		cprintf("send 0 from %x to %x\n", sys_getenvid(), who);
  80009d:	e8 06 0b 00 00       	call   800ba8 <sys_getenvid>
  8000a2:	83 ec 04             	sub    $0x4,%esp
  8000a5:	53                   	push   %ebx
  8000a6:	50                   	push   %eax
  8000a7:	68 40 23 80 00       	push   $0x802340
  8000ac:	e8 22 01 00 00       	call   8001d3 <cprintf>
		ipc_send(who, 0, 0, 0);
  8000b1:	6a 00                	push   $0x0
  8000b3:	6a 00                	push   $0x0
  8000b5:	6a 00                	push   $0x0
  8000b7:	ff 75 e4             	pushl  -0x1c(%ebp)
  8000ba:	e8 02 11 00 00       	call   8011c1 <ipc_send>
  8000bf:	83 c4 20             	add    $0x20,%esp
  8000c2:	eb 88                	jmp    80004c <umain+0x19>

008000c4 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8000c4:	f3 0f 1e fb          	endbr32 
  8000c8:	55                   	push   %ebp
  8000c9:	89 e5                	mov    %esp,%ebp
  8000cb:	56                   	push   %esi
  8000cc:	53                   	push   %ebx
  8000cd:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8000d0:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8000d3:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  8000da:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8000dd:	e8 c6 0a 00 00       	call   800ba8 <sys_getenvid>
  8000e2:	25 ff 03 00 00       	and    $0x3ff,%eax
  8000e7:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8000ea:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8000ef:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8000f4:	85 db                	test   %ebx,%ebx
  8000f6:	7e 07                	jle    8000ff <libmain+0x3b>
		binaryname = argv[0];
  8000f8:	8b 06                	mov    (%esi),%eax
  8000fa:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  8000ff:	83 ec 08             	sub    $0x8,%esp
  800102:	56                   	push   %esi
  800103:	53                   	push   %ebx
  800104:	e8 2a ff ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  800109:	e8 0a 00 00 00       	call   800118 <exit>
}
  80010e:	83 c4 10             	add    $0x10,%esp
  800111:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800114:	5b                   	pop    %ebx
  800115:	5e                   	pop    %esi
  800116:	5d                   	pop    %ebp
  800117:	c3                   	ret    

00800118 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800118:	f3 0f 1e fb          	endbr32 
  80011c:	55                   	push   %ebp
  80011d:	89 e5                	mov    %esp,%ebp
  80011f:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800122:	e8 1e 13 00 00       	call   801445 <close_all>
	sys_env_destroy(0);
  800127:	83 ec 0c             	sub    $0xc,%esp
  80012a:	6a 00                	push   $0x0
  80012c:	e8 32 0a 00 00       	call   800b63 <sys_env_destroy>
}
  800131:	83 c4 10             	add    $0x10,%esp
  800134:	c9                   	leave  
  800135:	c3                   	ret    

00800136 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800136:	f3 0f 1e fb          	endbr32 
  80013a:	55                   	push   %ebp
  80013b:	89 e5                	mov    %esp,%ebp
  80013d:	53                   	push   %ebx
  80013e:	83 ec 04             	sub    $0x4,%esp
  800141:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800144:	8b 13                	mov    (%ebx),%edx
  800146:	8d 42 01             	lea    0x1(%edx),%eax
  800149:	89 03                	mov    %eax,(%ebx)
  80014b:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80014e:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800152:	3d ff 00 00 00       	cmp    $0xff,%eax
  800157:	74 09                	je     800162 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  800159:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  80015d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800160:	c9                   	leave  
  800161:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800162:	83 ec 08             	sub    $0x8,%esp
  800165:	68 ff 00 00 00       	push   $0xff
  80016a:	8d 43 08             	lea    0x8(%ebx),%eax
  80016d:	50                   	push   %eax
  80016e:	e8 ab 09 00 00       	call   800b1e <sys_cputs>
		b->idx = 0;
  800173:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  800179:	83 c4 10             	add    $0x10,%esp
  80017c:	eb db                	jmp    800159 <putch+0x23>

0080017e <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  80017e:	f3 0f 1e fb          	endbr32 
  800182:	55                   	push   %ebp
  800183:	89 e5                	mov    %esp,%ebp
  800185:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80018b:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800192:	00 00 00 
	b.cnt = 0;
  800195:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  80019c:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  80019f:	ff 75 0c             	pushl  0xc(%ebp)
  8001a2:	ff 75 08             	pushl  0x8(%ebp)
  8001a5:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8001ab:	50                   	push   %eax
  8001ac:	68 36 01 80 00       	push   $0x800136
  8001b1:	e8 20 01 00 00       	call   8002d6 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8001b6:	83 c4 08             	add    $0x8,%esp
  8001b9:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8001bf:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8001c5:	50                   	push   %eax
  8001c6:	e8 53 09 00 00       	call   800b1e <sys_cputs>

	return b.cnt;
}
  8001cb:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8001d1:	c9                   	leave  
  8001d2:	c3                   	ret    

008001d3 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8001d3:	f3 0f 1e fb          	endbr32 
  8001d7:	55                   	push   %ebp
  8001d8:	89 e5                	mov    %esp,%ebp
  8001da:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8001dd:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8001e0:	50                   	push   %eax
  8001e1:	ff 75 08             	pushl  0x8(%ebp)
  8001e4:	e8 95 ff ff ff       	call   80017e <vcprintf>
	va_end(ap);

	return cnt;
}
  8001e9:	c9                   	leave  
  8001ea:	c3                   	ret    

008001eb <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8001eb:	55                   	push   %ebp
  8001ec:	89 e5                	mov    %esp,%ebp
  8001ee:	57                   	push   %edi
  8001ef:	56                   	push   %esi
  8001f0:	53                   	push   %ebx
  8001f1:	83 ec 1c             	sub    $0x1c,%esp
  8001f4:	89 c7                	mov    %eax,%edi
  8001f6:	89 d6                	mov    %edx,%esi
  8001f8:	8b 45 08             	mov    0x8(%ebp),%eax
  8001fb:	8b 55 0c             	mov    0xc(%ebp),%edx
  8001fe:	89 d1                	mov    %edx,%ecx
  800200:	89 c2                	mov    %eax,%edx
  800202:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800205:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800208:	8b 45 10             	mov    0x10(%ebp),%eax
  80020b:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  80020e:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800211:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800218:	39 c2                	cmp    %eax,%edx
  80021a:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  80021d:	72 3e                	jb     80025d <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  80021f:	83 ec 0c             	sub    $0xc,%esp
  800222:	ff 75 18             	pushl  0x18(%ebp)
  800225:	83 eb 01             	sub    $0x1,%ebx
  800228:	53                   	push   %ebx
  800229:	50                   	push   %eax
  80022a:	83 ec 08             	sub    $0x8,%esp
  80022d:	ff 75 e4             	pushl  -0x1c(%ebp)
  800230:	ff 75 e0             	pushl  -0x20(%ebp)
  800233:	ff 75 dc             	pushl  -0x24(%ebp)
  800236:	ff 75 d8             	pushl  -0x28(%ebp)
  800239:	e8 92 1e 00 00       	call   8020d0 <__udivdi3>
  80023e:	83 c4 18             	add    $0x18,%esp
  800241:	52                   	push   %edx
  800242:	50                   	push   %eax
  800243:	89 f2                	mov    %esi,%edx
  800245:	89 f8                	mov    %edi,%eax
  800247:	e8 9f ff ff ff       	call   8001eb <printnum>
  80024c:	83 c4 20             	add    $0x20,%esp
  80024f:	eb 13                	jmp    800264 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800251:	83 ec 08             	sub    $0x8,%esp
  800254:	56                   	push   %esi
  800255:	ff 75 18             	pushl  0x18(%ebp)
  800258:	ff d7                	call   *%edi
  80025a:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  80025d:	83 eb 01             	sub    $0x1,%ebx
  800260:	85 db                	test   %ebx,%ebx
  800262:	7f ed                	jg     800251 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800264:	83 ec 08             	sub    $0x8,%esp
  800267:	56                   	push   %esi
  800268:	83 ec 04             	sub    $0x4,%esp
  80026b:	ff 75 e4             	pushl  -0x1c(%ebp)
  80026e:	ff 75 e0             	pushl  -0x20(%ebp)
  800271:	ff 75 dc             	pushl  -0x24(%ebp)
  800274:	ff 75 d8             	pushl  -0x28(%ebp)
  800277:	e8 64 1f 00 00       	call   8021e0 <__umoddi3>
  80027c:	83 c4 14             	add    $0x14,%esp
  80027f:	0f be 80 73 23 80 00 	movsbl 0x802373(%eax),%eax
  800286:	50                   	push   %eax
  800287:	ff d7                	call   *%edi
}
  800289:	83 c4 10             	add    $0x10,%esp
  80028c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80028f:	5b                   	pop    %ebx
  800290:	5e                   	pop    %esi
  800291:	5f                   	pop    %edi
  800292:	5d                   	pop    %ebp
  800293:	c3                   	ret    

00800294 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800294:	f3 0f 1e fb          	endbr32 
  800298:	55                   	push   %ebp
  800299:	89 e5                	mov    %esp,%ebp
  80029b:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  80029e:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002a2:	8b 10                	mov    (%eax),%edx
  8002a4:	3b 50 04             	cmp    0x4(%eax),%edx
  8002a7:	73 0a                	jae    8002b3 <sprintputch+0x1f>
		*b->buf++ = ch;
  8002a9:	8d 4a 01             	lea    0x1(%edx),%ecx
  8002ac:	89 08                	mov    %ecx,(%eax)
  8002ae:	8b 45 08             	mov    0x8(%ebp),%eax
  8002b1:	88 02                	mov    %al,(%edx)
}
  8002b3:	5d                   	pop    %ebp
  8002b4:	c3                   	ret    

008002b5 <printfmt>:
{
  8002b5:	f3 0f 1e fb          	endbr32 
  8002b9:	55                   	push   %ebp
  8002ba:	89 e5                	mov    %esp,%ebp
  8002bc:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8002bf:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8002c2:	50                   	push   %eax
  8002c3:	ff 75 10             	pushl  0x10(%ebp)
  8002c6:	ff 75 0c             	pushl  0xc(%ebp)
  8002c9:	ff 75 08             	pushl  0x8(%ebp)
  8002cc:	e8 05 00 00 00       	call   8002d6 <vprintfmt>
}
  8002d1:	83 c4 10             	add    $0x10,%esp
  8002d4:	c9                   	leave  
  8002d5:	c3                   	ret    

008002d6 <vprintfmt>:
{
  8002d6:	f3 0f 1e fb          	endbr32 
  8002da:	55                   	push   %ebp
  8002db:	89 e5                	mov    %esp,%ebp
  8002dd:	57                   	push   %edi
  8002de:	56                   	push   %esi
  8002df:	53                   	push   %ebx
  8002e0:	83 ec 3c             	sub    $0x3c,%esp
  8002e3:	8b 75 08             	mov    0x8(%ebp),%esi
  8002e6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8002e9:	8b 7d 10             	mov    0x10(%ebp),%edi
  8002ec:	e9 5d 03 00 00       	jmp    80064e <vprintfmt+0x378>
		padc = ' ';
  8002f1:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  8002f5:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  8002fc:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800303:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80030a:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80030f:	8d 47 01             	lea    0x1(%edi),%eax
  800312:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800315:	0f b6 17             	movzbl (%edi),%edx
  800318:	8d 42 dd             	lea    -0x23(%edx),%eax
  80031b:	3c 55                	cmp    $0x55,%al
  80031d:	0f 87 ae 03 00 00    	ja     8006d1 <vprintfmt+0x3fb>
  800323:	0f b6 c0             	movzbl %al,%eax
  800326:	3e ff 24 85 c0 24 80 	notrack jmp *0x8024c0(,%eax,4)
  80032d:	00 
  80032e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800331:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800335:	eb d8                	jmp    80030f <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800337:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80033a:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  80033e:	eb cf                	jmp    80030f <vprintfmt+0x39>
  800340:	0f b6 d2             	movzbl %dl,%edx
  800343:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  800346:	b8 00 00 00 00       	mov    $0x0,%eax
  80034b:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  80034e:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800351:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800355:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  800358:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80035b:	83 f9 09             	cmp    $0x9,%ecx
  80035e:	77 55                	ja     8003b5 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  800360:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800363:	eb e9                	jmp    80034e <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800365:	8b 45 14             	mov    0x14(%ebp),%eax
  800368:	8b 00                	mov    (%eax),%eax
  80036a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80036d:	8b 45 14             	mov    0x14(%ebp),%eax
  800370:	8d 40 04             	lea    0x4(%eax),%eax
  800373:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800376:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  800379:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  80037d:	79 90                	jns    80030f <vprintfmt+0x39>
				width = precision, precision = -1;
  80037f:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800382:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800385:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  80038c:	eb 81                	jmp    80030f <vprintfmt+0x39>
  80038e:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800391:	85 c0                	test   %eax,%eax
  800393:	ba 00 00 00 00       	mov    $0x0,%edx
  800398:	0f 49 d0             	cmovns %eax,%edx
  80039b:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80039e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003a1:	e9 69 ff ff ff       	jmp    80030f <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003a6:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8003a9:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8003b0:	e9 5a ff ff ff       	jmp    80030f <vprintfmt+0x39>
  8003b5:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8003b8:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003bb:	eb bc                	jmp    800379 <vprintfmt+0xa3>
			lflag++;
  8003bd:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8003c0:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003c3:	e9 47 ff ff ff       	jmp    80030f <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8003c8:	8b 45 14             	mov    0x14(%ebp),%eax
  8003cb:	8d 78 04             	lea    0x4(%eax),%edi
  8003ce:	83 ec 08             	sub    $0x8,%esp
  8003d1:	53                   	push   %ebx
  8003d2:	ff 30                	pushl  (%eax)
  8003d4:	ff d6                	call   *%esi
			break;
  8003d6:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8003d9:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8003dc:	e9 6a 02 00 00       	jmp    80064b <vprintfmt+0x375>
			err = va_arg(ap, int);
  8003e1:	8b 45 14             	mov    0x14(%ebp),%eax
  8003e4:	8d 78 04             	lea    0x4(%eax),%edi
  8003e7:	8b 00                	mov    (%eax),%eax
  8003e9:	99                   	cltd   
  8003ea:	31 d0                	xor    %edx,%eax
  8003ec:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8003ee:	83 f8 0f             	cmp    $0xf,%eax
  8003f1:	7f 23                	jg     800416 <vprintfmt+0x140>
  8003f3:	8b 14 85 20 26 80 00 	mov    0x802620(,%eax,4),%edx
  8003fa:	85 d2                	test   %edx,%edx
  8003fc:	74 18                	je     800416 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  8003fe:	52                   	push   %edx
  8003ff:	68 c1 28 80 00       	push   $0x8028c1
  800404:	53                   	push   %ebx
  800405:	56                   	push   %esi
  800406:	e8 aa fe ff ff       	call   8002b5 <printfmt>
  80040b:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80040e:	89 7d 14             	mov    %edi,0x14(%ebp)
  800411:	e9 35 02 00 00       	jmp    80064b <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800416:	50                   	push   %eax
  800417:	68 8b 23 80 00       	push   $0x80238b
  80041c:	53                   	push   %ebx
  80041d:	56                   	push   %esi
  80041e:	e8 92 fe ff ff       	call   8002b5 <printfmt>
  800423:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800426:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800429:	e9 1d 02 00 00       	jmp    80064b <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  80042e:	8b 45 14             	mov    0x14(%ebp),%eax
  800431:	83 c0 04             	add    $0x4,%eax
  800434:	89 45 c8             	mov    %eax,-0x38(%ebp)
  800437:	8b 45 14             	mov    0x14(%ebp),%eax
  80043a:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  80043c:	85 d2                	test   %edx,%edx
  80043e:	b8 84 23 80 00       	mov    $0x802384,%eax
  800443:	0f 45 c2             	cmovne %edx,%eax
  800446:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  800449:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  80044d:	7e 06                	jle    800455 <vprintfmt+0x17f>
  80044f:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800453:	75 0d                	jne    800462 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800455:	8b 45 cc             	mov    -0x34(%ebp),%eax
  800458:	89 c7                	mov    %eax,%edi
  80045a:	03 45 d4             	add    -0x2c(%ebp),%eax
  80045d:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800460:	eb 55                	jmp    8004b7 <vprintfmt+0x1e1>
  800462:	83 ec 08             	sub    $0x8,%esp
  800465:	ff 75 d8             	pushl  -0x28(%ebp)
  800468:	ff 75 cc             	pushl  -0x34(%ebp)
  80046b:	e8 15 03 00 00       	call   800785 <strnlen>
  800470:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800473:	29 c2                	sub    %eax,%edx
  800475:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  800478:	83 c4 10             	add    $0x10,%esp
  80047b:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  80047d:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800481:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800484:	85 ff                	test   %edi,%edi
  800486:	7e 11                	jle    800499 <vprintfmt+0x1c3>
					putch(padc, putdat);
  800488:	83 ec 08             	sub    $0x8,%esp
  80048b:	53                   	push   %ebx
  80048c:	ff 75 d4             	pushl  -0x2c(%ebp)
  80048f:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800491:	83 ef 01             	sub    $0x1,%edi
  800494:	83 c4 10             	add    $0x10,%esp
  800497:	eb eb                	jmp    800484 <vprintfmt+0x1ae>
  800499:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  80049c:	85 d2                	test   %edx,%edx
  80049e:	b8 00 00 00 00       	mov    $0x0,%eax
  8004a3:	0f 49 c2             	cmovns %edx,%eax
  8004a6:	29 c2                	sub    %eax,%edx
  8004a8:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8004ab:	eb a8                	jmp    800455 <vprintfmt+0x17f>
					putch(ch, putdat);
  8004ad:	83 ec 08             	sub    $0x8,%esp
  8004b0:	53                   	push   %ebx
  8004b1:	52                   	push   %edx
  8004b2:	ff d6                	call   *%esi
  8004b4:	83 c4 10             	add    $0x10,%esp
  8004b7:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8004ba:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004bc:	83 c7 01             	add    $0x1,%edi
  8004bf:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8004c3:	0f be d0             	movsbl %al,%edx
  8004c6:	85 d2                	test   %edx,%edx
  8004c8:	74 4b                	je     800515 <vprintfmt+0x23f>
  8004ca:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8004ce:	78 06                	js     8004d6 <vprintfmt+0x200>
  8004d0:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8004d4:	78 1e                	js     8004f4 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  8004d6:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  8004da:	74 d1                	je     8004ad <vprintfmt+0x1d7>
  8004dc:	0f be c0             	movsbl %al,%eax
  8004df:	83 e8 20             	sub    $0x20,%eax
  8004e2:	83 f8 5e             	cmp    $0x5e,%eax
  8004e5:	76 c6                	jbe    8004ad <vprintfmt+0x1d7>
					putch('?', putdat);
  8004e7:	83 ec 08             	sub    $0x8,%esp
  8004ea:	53                   	push   %ebx
  8004eb:	6a 3f                	push   $0x3f
  8004ed:	ff d6                	call   *%esi
  8004ef:	83 c4 10             	add    $0x10,%esp
  8004f2:	eb c3                	jmp    8004b7 <vprintfmt+0x1e1>
  8004f4:	89 cf                	mov    %ecx,%edi
  8004f6:	eb 0e                	jmp    800506 <vprintfmt+0x230>
				putch(' ', putdat);
  8004f8:	83 ec 08             	sub    $0x8,%esp
  8004fb:	53                   	push   %ebx
  8004fc:	6a 20                	push   $0x20
  8004fe:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800500:	83 ef 01             	sub    $0x1,%edi
  800503:	83 c4 10             	add    $0x10,%esp
  800506:	85 ff                	test   %edi,%edi
  800508:	7f ee                	jg     8004f8 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80050a:	8b 45 c8             	mov    -0x38(%ebp),%eax
  80050d:	89 45 14             	mov    %eax,0x14(%ebp)
  800510:	e9 36 01 00 00       	jmp    80064b <vprintfmt+0x375>
  800515:	89 cf                	mov    %ecx,%edi
  800517:	eb ed                	jmp    800506 <vprintfmt+0x230>
	if (lflag >= 2)
  800519:	83 f9 01             	cmp    $0x1,%ecx
  80051c:	7f 1f                	jg     80053d <vprintfmt+0x267>
	else if (lflag)
  80051e:	85 c9                	test   %ecx,%ecx
  800520:	74 67                	je     800589 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800522:	8b 45 14             	mov    0x14(%ebp),%eax
  800525:	8b 00                	mov    (%eax),%eax
  800527:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80052a:	89 c1                	mov    %eax,%ecx
  80052c:	c1 f9 1f             	sar    $0x1f,%ecx
  80052f:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800532:	8b 45 14             	mov    0x14(%ebp),%eax
  800535:	8d 40 04             	lea    0x4(%eax),%eax
  800538:	89 45 14             	mov    %eax,0x14(%ebp)
  80053b:	eb 17                	jmp    800554 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  80053d:	8b 45 14             	mov    0x14(%ebp),%eax
  800540:	8b 50 04             	mov    0x4(%eax),%edx
  800543:	8b 00                	mov    (%eax),%eax
  800545:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800548:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80054b:	8b 45 14             	mov    0x14(%ebp),%eax
  80054e:	8d 40 08             	lea    0x8(%eax),%eax
  800551:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800554:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800557:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80055a:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  80055f:	85 c9                	test   %ecx,%ecx
  800561:	0f 89 ca 00 00 00    	jns    800631 <vprintfmt+0x35b>
				putch('-', putdat);
  800567:	83 ec 08             	sub    $0x8,%esp
  80056a:	53                   	push   %ebx
  80056b:	6a 2d                	push   $0x2d
  80056d:	ff d6                	call   *%esi
				num = -(long long) num;
  80056f:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800572:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800575:	f7 da                	neg    %edx
  800577:	83 d1 00             	adc    $0x0,%ecx
  80057a:	f7 d9                	neg    %ecx
  80057c:	83 c4 10             	add    $0x10,%esp
			base = 10;
  80057f:	b8 0a 00 00 00       	mov    $0xa,%eax
  800584:	e9 a8 00 00 00       	jmp    800631 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  800589:	8b 45 14             	mov    0x14(%ebp),%eax
  80058c:	8b 00                	mov    (%eax),%eax
  80058e:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800591:	99                   	cltd   
  800592:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800595:	8b 45 14             	mov    0x14(%ebp),%eax
  800598:	8d 40 04             	lea    0x4(%eax),%eax
  80059b:	89 45 14             	mov    %eax,0x14(%ebp)
  80059e:	eb b4                	jmp    800554 <vprintfmt+0x27e>
	if (lflag >= 2)
  8005a0:	83 f9 01             	cmp    $0x1,%ecx
  8005a3:	7f 1b                	jg     8005c0 <vprintfmt+0x2ea>
	else if (lflag)
  8005a5:	85 c9                	test   %ecx,%ecx
  8005a7:	74 2c                	je     8005d5 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8005a9:	8b 45 14             	mov    0x14(%ebp),%eax
  8005ac:	8b 10                	mov    (%eax),%edx
  8005ae:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005b3:	8d 40 04             	lea    0x4(%eax),%eax
  8005b6:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005b9:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8005be:	eb 71                	jmp    800631 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8005c0:	8b 45 14             	mov    0x14(%ebp),%eax
  8005c3:	8b 10                	mov    (%eax),%edx
  8005c5:	8b 48 04             	mov    0x4(%eax),%ecx
  8005c8:	8d 40 08             	lea    0x8(%eax),%eax
  8005cb:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005ce:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8005d3:	eb 5c                	jmp    800631 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8005d5:	8b 45 14             	mov    0x14(%ebp),%eax
  8005d8:	8b 10                	mov    (%eax),%edx
  8005da:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005df:	8d 40 04             	lea    0x4(%eax),%eax
  8005e2:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005e5:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8005ea:	eb 45                	jmp    800631 <vprintfmt+0x35b>
			putch('X', putdat);
  8005ec:	83 ec 08             	sub    $0x8,%esp
  8005ef:	53                   	push   %ebx
  8005f0:	6a 58                	push   $0x58
  8005f2:	ff d6                	call   *%esi
			putch('X', putdat);
  8005f4:	83 c4 08             	add    $0x8,%esp
  8005f7:	53                   	push   %ebx
  8005f8:	6a 58                	push   $0x58
  8005fa:	ff d6                	call   *%esi
			putch('X', putdat);
  8005fc:	83 c4 08             	add    $0x8,%esp
  8005ff:	53                   	push   %ebx
  800600:	6a 58                	push   $0x58
  800602:	ff d6                	call   *%esi
			break;
  800604:	83 c4 10             	add    $0x10,%esp
  800607:	eb 42                	jmp    80064b <vprintfmt+0x375>
			putch('0', putdat);
  800609:	83 ec 08             	sub    $0x8,%esp
  80060c:	53                   	push   %ebx
  80060d:	6a 30                	push   $0x30
  80060f:	ff d6                	call   *%esi
			putch('x', putdat);
  800611:	83 c4 08             	add    $0x8,%esp
  800614:	53                   	push   %ebx
  800615:	6a 78                	push   $0x78
  800617:	ff d6                	call   *%esi
			num = (unsigned long long)
  800619:	8b 45 14             	mov    0x14(%ebp),%eax
  80061c:	8b 10                	mov    (%eax),%edx
  80061e:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800623:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800626:	8d 40 04             	lea    0x4(%eax),%eax
  800629:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80062c:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800631:	83 ec 0c             	sub    $0xc,%esp
  800634:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  800638:	57                   	push   %edi
  800639:	ff 75 d4             	pushl  -0x2c(%ebp)
  80063c:	50                   	push   %eax
  80063d:	51                   	push   %ecx
  80063e:	52                   	push   %edx
  80063f:	89 da                	mov    %ebx,%edx
  800641:	89 f0                	mov    %esi,%eax
  800643:	e8 a3 fb ff ff       	call   8001eb <printnum>
			break;
  800648:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80064b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  80064e:	83 c7 01             	add    $0x1,%edi
  800651:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800655:	83 f8 25             	cmp    $0x25,%eax
  800658:	0f 84 93 fc ff ff    	je     8002f1 <vprintfmt+0x1b>
			if (ch == '\0')
  80065e:	85 c0                	test   %eax,%eax
  800660:	0f 84 8b 00 00 00    	je     8006f1 <vprintfmt+0x41b>
			putch(ch, putdat);
  800666:	83 ec 08             	sub    $0x8,%esp
  800669:	53                   	push   %ebx
  80066a:	50                   	push   %eax
  80066b:	ff d6                	call   *%esi
  80066d:	83 c4 10             	add    $0x10,%esp
  800670:	eb dc                	jmp    80064e <vprintfmt+0x378>
	if (lflag >= 2)
  800672:	83 f9 01             	cmp    $0x1,%ecx
  800675:	7f 1b                	jg     800692 <vprintfmt+0x3bc>
	else if (lflag)
  800677:	85 c9                	test   %ecx,%ecx
  800679:	74 2c                	je     8006a7 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  80067b:	8b 45 14             	mov    0x14(%ebp),%eax
  80067e:	8b 10                	mov    (%eax),%edx
  800680:	b9 00 00 00 00       	mov    $0x0,%ecx
  800685:	8d 40 04             	lea    0x4(%eax),%eax
  800688:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80068b:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800690:	eb 9f                	jmp    800631 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800692:	8b 45 14             	mov    0x14(%ebp),%eax
  800695:	8b 10                	mov    (%eax),%edx
  800697:	8b 48 04             	mov    0x4(%eax),%ecx
  80069a:	8d 40 08             	lea    0x8(%eax),%eax
  80069d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006a0:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8006a5:	eb 8a                	jmp    800631 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006a7:	8b 45 14             	mov    0x14(%ebp),%eax
  8006aa:	8b 10                	mov    (%eax),%edx
  8006ac:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006b1:	8d 40 04             	lea    0x4(%eax),%eax
  8006b4:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006b7:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8006bc:	e9 70 ff ff ff       	jmp    800631 <vprintfmt+0x35b>
			putch(ch, putdat);
  8006c1:	83 ec 08             	sub    $0x8,%esp
  8006c4:	53                   	push   %ebx
  8006c5:	6a 25                	push   $0x25
  8006c7:	ff d6                	call   *%esi
			break;
  8006c9:	83 c4 10             	add    $0x10,%esp
  8006cc:	e9 7a ff ff ff       	jmp    80064b <vprintfmt+0x375>
			putch('%', putdat);
  8006d1:	83 ec 08             	sub    $0x8,%esp
  8006d4:	53                   	push   %ebx
  8006d5:	6a 25                	push   $0x25
  8006d7:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8006d9:	83 c4 10             	add    $0x10,%esp
  8006dc:	89 f8                	mov    %edi,%eax
  8006de:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8006e2:	74 05                	je     8006e9 <vprintfmt+0x413>
  8006e4:	83 e8 01             	sub    $0x1,%eax
  8006e7:	eb f5                	jmp    8006de <vprintfmt+0x408>
  8006e9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8006ec:	e9 5a ff ff ff       	jmp    80064b <vprintfmt+0x375>
}
  8006f1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8006f4:	5b                   	pop    %ebx
  8006f5:	5e                   	pop    %esi
  8006f6:	5f                   	pop    %edi
  8006f7:	5d                   	pop    %ebp
  8006f8:	c3                   	ret    

008006f9 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8006f9:	f3 0f 1e fb          	endbr32 
  8006fd:	55                   	push   %ebp
  8006fe:	89 e5                	mov    %esp,%ebp
  800700:	83 ec 18             	sub    $0x18,%esp
  800703:	8b 45 08             	mov    0x8(%ebp),%eax
  800706:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800709:	89 45 ec             	mov    %eax,-0x14(%ebp)
  80070c:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800710:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800713:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80071a:	85 c0                	test   %eax,%eax
  80071c:	74 26                	je     800744 <vsnprintf+0x4b>
  80071e:	85 d2                	test   %edx,%edx
  800720:	7e 22                	jle    800744 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800722:	ff 75 14             	pushl  0x14(%ebp)
  800725:	ff 75 10             	pushl  0x10(%ebp)
  800728:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80072b:	50                   	push   %eax
  80072c:	68 94 02 80 00       	push   $0x800294
  800731:	e8 a0 fb ff ff       	call   8002d6 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800736:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800739:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  80073c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80073f:	83 c4 10             	add    $0x10,%esp
}
  800742:	c9                   	leave  
  800743:	c3                   	ret    
		return -E_INVAL;
  800744:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800749:	eb f7                	jmp    800742 <vsnprintf+0x49>

0080074b <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80074b:	f3 0f 1e fb          	endbr32 
  80074f:	55                   	push   %ebp
  800750:	89 e5                	mov    %esp,%ebp
  800752:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800755:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  800758:	50                   	push   %eax
  800759:	ff 75 10             	pushl  0x10(%ebp)
  80075c:	ff 75 0c             	pushl  0xc(%ebp)
  80075f:	ff 75 08             	pushl  0x8(%ebp)
  800762:	e8 92 ff ff ff       	call   8006f9 <vsnprintf>
	va_end(ap);

	return rc;
}
  800767:	c9                   	leave  
  800768:	c3                   	ret    

00800769 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  800769:	f3 0f 1e fb          	endbr32 
  80076d:	55                   	push   %ebp
  80076e:	89 e5                	mov    %esp,%ebp
  800770:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800773:	b8 00 00 00 00       	mov    $0x0,%eax
  800778:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  80077c:	74 05                	je     800783 <strlen+0x1a>
		n++;
  80077e:	83 c0 01             	add    $0x1,%eax
  800781:	eb f5                	jmp    800778 <strlen+0xf>
	return n;
}
  800783:	5d                   	pop    %ebp
  800784:	c3                   	ret    

00800785 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800785:	f3 0f 1e fb          	endbr32 
  800789:	55                   	push   %ebp
  80078a:	89 e5                	mov    %esp,%ebp
  80078c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80078f:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800792:	b8 00 00 00 00       	mov    $0x0,%eax
  800797:	39 d0                	cmp    %edx,%eax
  800799:	74 0d                	je     8007a8 <strnlen+0x23>
  80079b:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  80079f:	74 05                	je     8007a6 <strnlen+0x21>
		n++;
  8007a1:	83 c0 01             	add    $0x1,%eax
  8007a4:	eb f1                	jmp    800797 <strnlen+0x12>
  8007a6:	89 c2                	mov    %eax,%edx
	return n;
}
  8007a8:	89 d0                	mov    %edx,%eax
  8007aa:	5d                   	pop    %ebp
  8007ab:	c3                   	ret    

008007ac <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007ac:	f3 0f 1e fb          	endbr32 
  8007b0:	55                   	push   %ebp
  8007b1:	89 e5                	mov    %esp,%ebp
  8007b3:	53                   	push   %ebx
  8007b4:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007b7:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8007ba:	b8 00 00 00 00       	mov    $0x0,%eax
  8007bf:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  8007c3:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  8007c6:	83 c0 01             	add    $0x1,%eax
  8007c9:	84 d2                	test   %dl,%dl
  8007cb:	75 f2                	jne    8007bf <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  8007cd:	89 c8                	mov    %ecx,%eax
  8007cf:	5b                   	pop    %ebx
  8007d0:	5d                   	pop    %ebp
  8007d1:	c3                   	ret    

008007d2 <strcat>:

char *
strcat(char *dst, const char *src)
{
  8007d2:	f3 0f 1e fb          	endbr32 
  8007d6:	55                   	push   %ebp
  8007d7:	89 e5                	mov    %esp,%ebp
  8007d9:	53                   	push   %ebx
  8007da:	83 ec 10             	sub    $0x10,%esp
  8007dd:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  8007e0:	53                   	push   %ebx
  8007e1:	e8 83 ff ff ff       	call   800769 <strlen>
  8007e6:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  8007e9:	ff 75 0c             	pushl  0xc(%ebp)
  8007ec:	01 d8                	add    %ebx,%eax
  8007ee:	50                   	push   %eax
  8007ef:	e8 b8 ff ff ff       	call   8007ac <strcpy>
	return dst;
}
  8007f4:	89 d8                	mov    %ebx,%eax
  8007f6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8007f9:	c9                   	leave  
  8007fa:	c3                   	ret    

008007fb <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  8007fb:	f3 0f 1e fb          	endbr32 
  8007ff:	55                   	push   %ebp
  800800:	89 e5                	mov    %esp,%ebp
  800802:	56                   	push   %esi
  800803:	53                   	push   %ebx
  800804:	8b 75 08             	mov    0x8(%ebp),%esi
  800807:	8b 55 0c             	mov    0xc(%ebp),%edx
  80080a:	89 f3                	mov    %esi,%ebx
  80080c:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  80080f:	89 f0                	mov    %esi,%eax
  800811:	39 d8                	cmp    %ebx,%eax
  800813:	74 11                	je     800826 <strncpy+0x2b>
		*dst++ = *src;
  800815:	83 c0 01             	add    $0x1,%eax
  800818:	0f b6 0a             	movzbl (%edx),%ecx
  80081b:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  80081e:	80 f9 01             	cmp    $0x1,%cl
  800821:	83 da ff             	sbb    $0xffffffff,%edx
  800824:	eb eb                	jmp    800811 <strncpy+0x16>
	}
	return ret;
}
  800826:	89 f0                	mov    %esi,%eax
  800828:	5b                   	pop    %ebx
  800829:	5e                   	pop    %esi
  80082a:	5d                   	pop    %ebp
  80082b:	c3                   	ret    

0080082c <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  80082c:	f3 0f 1e fb          	endbr32 
  800830:	55                   	push   %ebp
  800831:	89 e5                	mov    %esp,%ebp
  800833:	56                   	push   %esi
  800834:	53                   	push   %ebx
  800835:	8b 75 08             	mov    0x8(%ebp),%esi
  800838:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80083b:	8b 55 10             	mov    0x10(%ebp),%edx
  80083e:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800840:	85 d2                	test   %edx,%edx
  800842:	74 21                	je     800865 <strlcpy+0x39>
  800844:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  800848:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80084a:	39 c2                	cmp    %eax,%edx
  80084c:	74 14                	je     800862 <strlcpy+0x36>
  80084e:	0f b6 19             	movzbl (%ecx),%ebx
  800851:	84 db                	test   %bl,%bl
  800853:	74 0b                	je     800860 <strlcpy+0x34>
			*dst++ = *src++;
  800855:	83 c1 01             	add    $0x1,%ecx
  800858:	83 c2 01             	add    $0x1,%edx
  80085b:	88 5a ff             	mov    %bl,-0x1(%edx)
  80085e:	eb ea                	jmp    80084a <strlcpy+0x1e>
  800860:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800862:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800865:	29 f0                	sub    %esi,%eax
}
  800867:	5b                   	pop    %ebx
  800868:	5e                   	pop    %esi
  800869:	5d                   	pop    %ebp
  80086a:	c3                   	ret    

0080086b <strcmp>:

int
strcmp(const char *p, const char *q)
{
  80086b:	f3 0f 1e fb          	endbr32 
  80086f:	55                   	push   %ebp
  800870:	89 e5                	mov    %esp,%ebp
  800872:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800875:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  800878:	0f b6 01             	movzbl (%ecx),%eax
  80087b:	84 c0                	test   %al,%al
  80087d:	74 0c                	je     80088b <strcmp+0x20>
  80087f:	3a 02                	cmp    (%edx),%al
  800881:	75 08                	jne    80088b <strcmp+0x20>
		p++, q++;
  800883:	83 c1 01             	add    $0x1,%ecx
  800886:	83 c2 01             	add    $0x1,%edx
  800889:	eb ed                	jmp    800878 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  80088b:	0f b6 c0             	movzbl %al,%eax
  80088e:	0f b6 12             	movzbl (%edx),%edx
  800891:	29 d0                	sub    %edx,%eax
}
  800893:	5d                   	pop    %ebp
  800894:	c3                   	ret    

00800895 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800895:	f3 0f 1e fb          	endbr32 
  800899:	55                   	push   %ebp
  80089a:	89 e5                	mov    %esp,%ebp
  80089c:	53                   	push   %ebx
  80089d:	8b 45 08             	mov    0x8(%ebp),%eax
  8008a0:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008a3:	89 c3                	mov    %eax,%ebx
  8008a5:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8008a8:	eb 06                	jmp    8008b0 <strncmp+0x1b>
		n--, p++, q++;
  8008aa:	83 c0 01             	add    $0x1,%eax
  8008ad:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8008b0:	39 d8                	cmp    %ebx,%eax
  8008b2:	74 16                	je     8008ca <strncmp+0x35>
  8008b4:	0f b6 08             	movzbl (%eax),%ecx
  8008b7:	84 c9                	test   %cl,%cl
  8008b9:	74 04                	je     8008bf <strncmp+0x2a>
  8008bb:	3a 0a                	cmp    (%edx),%cl
  8008bd:	74 eb                	je     8008aa <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8008bf:	0f b6 00             	movzbl (%eax),%eax
  8008c2:	0f b6 12             	movzbl (%edx),%edx
  8008c5:	29 d0                	sub    %edx,%eax
}
  8008c7:	5b                   	pop    %ebx
  8008c8:	5d                   	pop    %ebp
  8008c9:	c3                   	ret    
		return 0;
  8008ca:	b8 00 00 00 00       	mov    $0x0,%eax
  8008cf:	eb f6                	jmp    8008c7 <strncmp+0x32>

008008d1 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8008d1:	f3 0f 1e fb          	endbr32 
  8008d5:	55                   	push   %ebp
  8008d6:	89 e5                	mov    %esp,%ebp
  8008d8:	8b 45 08             	mov    0x8(%ebp),%eax
  8008db:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8008df:	0f b6 10             	movzbl (%eax),%edx
  8008e2:	84 d2                	test   %dl,%dl
  8008e4:	74 09                	je     8008ef <strchr+0x1e>
		if (*s == c)
  8008e6:	38 ca                	cmp    %cl,%dl
  8008e8:	74 0a                	je     8008f4 <strchr+0x23>
	for (; *s; s++)
  8008ea:	83 c0 01             	add    $0x1,%eax
  8008ed:	eb f0                	jmp    8008df <strchr+0xe>
			return (char *) s;
	return 0;
  8008ef:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8008f4:	5d                   	pop    %ebp
  8008f5:	c3                   	ret    

008008f6 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  8008f6:	f3 0f 1e fb          	endbr32 
  8008fa:	55                   	push   %ebp
  8008fb:	89 e5                	mov    %esp,%ebp
  8008fd:	8b 45 08             	mov    0x8(%ebp),%eax
  800900:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800904:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800907:	38 ca                	cmp    %cl,%dl
  800909:	74 09                	je     800914 <strfind+0x1e>
  80090b:	84 d2                	test   %dl,%dl
  80090d:	74 05                	je     800914 <strfind+0x1e>
	for (; *s; s++)
  80090f:	83 c0 01             	add    $0x1,%eax
  800912:	eb f0                	jmp    800904 <strfind+0xe>
			break;
	return (char *) s;
}
  800914:	5d                   	pop    %ebp
  800915:	c3                   	ret    

00800916 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800916:	f3 0f 1e fb          	endbr32 
  80091a:	55                   	push   %ebp
  80091b:	89 e5                	mov    %esp,%ebp
  80091d:	57                   	push   %edi
  80091e:	56                   	push   %esi
  80091f:	53                   	push   %ebx
  800920:	8b 7d 08             	mov    0x8(%ebp),%edi
  800923:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800926:	85 c9                	test   %ecx,%ecx
  800928:	74 31                	je     80095b <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80092a:	89 f8                	mov    %edi,%eax
  80092c:	09 c8                	or     %ecx,%eax
  80092e:	a8 03                	test   $0x3,%al
  800930:	75 23                	jne    800955 <memset+0x3f>
		c &= 0xFF;
  800932:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800936:	89 d3                	mov    %edx,%ebx
  800938:	c1 e3 08             	shl    $0x8,%ebx
  80093b:	89 d0                	mov    %edx,%eax
  80093d:	c1 e0 18             	shl    $0x18,%eax
  800940:	89 d6                	mov    %edx,%esi
  800942:	c1 e6 10             	shl    $0x10,%esi
  800945:	09 f0                	or     %esi,%eax
  800947:	09 c2                	or     %eax,%edx
  800949:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  80094b:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  80094e:	89 d0                	mov    %edx,%eax
  800950:	fc                   	cld    
  800951:	f3 ab                	rep stos %eax,%es:(%edi)
  800953:	eb 06                	jmp    80095b <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800955:	8b 45 0c             	mov    0xc(%ebp),%eax
  800958:	fc                   	cld    
  800959:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  80095b:	89 f8                	mov    %edi,%eax
  80095d:	5b                   	pop    %ebx
  80095e:	5e                   	pop    %esi
  80095f:	5f                   	pop    %edi
  800960:	5d                   	pop    %ebp
  800961:	c3                   	ret    

00800962 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800962:	f3 0f 1e fb          	endbr32 
  800966:	55                   	push   %ebp
  800967:	89 e5                	mov    %esp,%ebp
  800969:	57                   	push   %edi
  80096a:	56                   	push   %esi
  80096b:	8b 45 08             	mov    0x8(%ebp),%eax
  80096e:	8b 75 0c             	mov    0xc(%ebp),%esi
  800971:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800974:	39 c6                	cmp    %eax,%esi
  800976:	73 32                	jae    8009aa <memmove+0x48>
  800978:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  80097b:	39 c2                	cmp    %eax,%edx
  80097d:	76 2b                	jbe    8009aa <memmove+0x48>
		s += n;
		d += n;
  80097f:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800982:	89 fe                	mov    %edi,%esi
  800984:	09 ce                	or     %ecx,%esi
  800986:	09 d6                	or     %edx,%esi
  800988:	f7 c6 03 00 00 00    	test   $0x3,%esi
  80098e:	75 0e                	jne    80099e <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800990:	83 ef 04             	sub    $0x4,%edi
  800993:	8d 72 fc             	lea    -0x4(%edx),%esi
  800996:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800999:	fd                   	std    
  80099a:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  80099c:	eb 09                	jmp    8009a7 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  80099e:	83 ef 01             	sub    $0x1,%edi
  8009a1:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  8009a4:	fd                   	std    
  8009a5:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  8009a7:	fc                   	cld    
  8009a8:	eb 1a                	jmp    8009c4 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009aa:	89 c2                	mov    %eax,%edx
  8009ac:	09 ca                	or     %ecx,%edx
  8009ae:	09 f2                	or     %esi,%edx
  8009b0:	f6 c2 03             	test   $0x3,%dl
  8009b3:	75 0a                	jne    8009bf <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  8009b5:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  8009b8:	89 c7                	mov    %eax,%edi
  8009ba:	fc                   	cld    
  8009bb:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009bd:	eb 05                	jmp    8009c4 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  8009bf:	89 c7                	mov    %eax,%edi
  8009c1:	fc                   	cld    
  8009c2:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  8009c4:	5e                   	pop    %esi
  8009c5:	5f                   	pop    %edi
  8009c6:	5d                   	pop    %ebp
  8009c7:	c3                   	ret    

008009c8 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  8009c8:	f3 0f 1e fb          	endbr32 
  8009cc:	55                   	push   %ebp
  8009cd:	89 e5                	mov    %esp,%ebp
  8009cf:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  8009d2:	ff 75 10             	pushl  0x10(%ebp)
  8009d5:	ff 75 0c             	pushl  0xc(%ebp)
  8009d8:	ff 75 08             	pushl  0x8(%ebp)
  8009db:	e8 82 ff ff ff       	call   800962 <memmove>
}
  8009e0:	c9                   	leave  
  8009e1:	c3                   	ret    

008009e2 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  8009e2:	f3 0f 1e fb          	endbr32 
  8009e6:	55                   	push   %ebp
  8009e7:	89 e5                	mov    %esp,%ebp
  8009e9:	56                   	push   %esi
  8009ea:	53                   	push   %ebx
  8009eb:	8b 45 08             	mov    0x8(%ebp),%eax
  8009ee:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009f1:	89 c6                	mov    %eax,%esi
  8009f3:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  8009f6:	39 f0                	cmp    %esi,%eax
  8009f8:	74 1c                	je     800a16 <memcmp+0x34>
		if (*s1 != *s2)
  8009fa:	0f b6 08             	movzbl (%eax),%ecx
  8009fd:	0f b6 1a             	movzbl (%edx),%ebx
  800a00:	38 d9                	cmp    %bl,%cl
  800a02:	75 08                	jne    800a0c <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a04:	83 c0 01             	add    $0x1,%eax
  800a07:	83 c2 01             	add    $0x1,%edx
  800a0a:	eb ea                	jmp    8009f6 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a0c:	0f b6 c1             	movzbl %cl,%eax
  800a0f:	0f b6 db             	movzbl %bl,%ebx
  800a12:	29 d8                	sub    %ebx,%eax
  800a14:	eb 05                	jmp    800a1b <memcmp+0x39>
	}

	return 0;
  800a16:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a1b:	5b                   	pop    %ebx
  800a1c:	5e                   	pop    %esi
  800a1d:	5d                   	pop    %ebp
  800a1e:	c3                   	ret    

00800a1f <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a1f:	f3 0f 1e fb          	endbr32 
  800a23:	55                   	push   %ebp
  800a24:	89 e5                	mov    %esp,%ebp
  800a26:	8b 45 08             	mov    0x8(%ebp),%eax
  800a29:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a2c:	89 c2                	mov    %eax,%edx
  800a2e:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a31:	39 d0                	cmp    %edx,%eax
  800a33:	73 09                	jae    800a3e <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a35:	38 08                	cmp    %cl,(%eax)
  800a37:	74 05                	je     800a3e <memfind+0x1f>
	for (; s < ends; s++)
  800a39:	83 c0 01             	add    $0x1,%eax
  800a3c:	eb f3                	jmp    800a31 <memfind+0x12>
			break;
	return (void *) s;
}
  800a3e:	5d                   	pop    %ebp
  800a3f:	c3                   	ret    

00800a40 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a40:	f3 0f 1e fb          	endbr32 
  800a44:	55                   	push   %ebp
  800a45:	89 e5                	mov    %esp,%ebp
  800a47:	57                   	push   %edi
  800a48:	56                   	push   %esi
  800a49:	53                   	push   %ebx
  800a4a:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a4d:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a50:	eb 03                	jmp    800a55 <strtol+0x15>
		s++;
  800a52:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a55:	0f b6 01             	movzbl (%ecx),%eax
  800a58:	3c 20                	cmp    $0x20,%al
  800a5a:	74 f6                	je     800a52 <strtol+0x12>
  800a5c:	3c 09                	cmp    $0x9,%al
  800a5e:	74 f2                	je     800a52 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800a60:	3c 2b                	cmp    $0x2b,%al
  800a62:	74 2a                	je     800a8e <strtol+0x4e>
	int neg = 0;
  800a64:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800a69:	3c 2d                	cmp    $0x2d,%al
  800a6b:	74 2b                	je     800a98 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a6d:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800a73:	75 0f                	jne    800a84 <strtol+0x44>
  800a75:	80 39 30             	cmpb   $0x30,(%ecx)
  800a78:	74 28                	je     800aa2 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800a7a:	85 db                	test   %ebx,%ebx
  800a7c:	b8 0a 00 00 00       	mov    $0xa,%eax
  800a81:	0f 44 d8             	cmove  %eax,%ebx
  800a84:	b8 00 00 00 00       	mov    $0x0,%eax
  800a89:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800a8c:	eb 46                	jmp    800ad4 <strtol+0x94>
		s++;
  800a8e:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800a91:	bf 00 00 00 00       	mov    $0x0,%edi
  800a96:	eb d5                	jmp    800a6d <strtol+0x2d>
		s++, neg = 1;
  800a98:	83 c1 01             	add    $0x1,%ecx
  800a9b:	bf 01 00 00 00       	mov    $0x1,%edi
  800aa0:	eb cb                	jmp    800a6d <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800aa2:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800aa6:	74 0e                	je     800ab6 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800aa8:	85 db                	test   %ebx,%ebx
  800aaa:	75 d8                	jne    800a84 <strtol+0x44>
		s++, base = 8;
  800aac:	83 c1 01             	add    $0x1,%ecx
  800aaf:	bb 08 00 00 00       	mov    $0x8,%ebx
  800ab4:	eb ce                	jmp    800a84 <strtol+0x44>
		s += 2, base = 16;
  800ab6:	83 c1 02             	add    $0x2,%ecx
  800ab9:	bb 10 00 00 00       	mov    $0x10,%ebx
  800abe:	eb c4                	jmp    800a84 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800ac0:	0f be d2             	movsbl %dl,%edx
  800ac3:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800ac6:	3b 55 10             	cmp    0x10(%ebp),%edx
  800ac9:	7d 3a                	jge    800b05 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800acb:	83 c1 01             	add    $0x1,%ecx
  800ace:	0f af 45 10          	imul   0x10(%ebp),%eax
  800ad2:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800ad4:	0f b6 11             	movzbl (%ecx),%edx
  800ad7:	8d 72 d0             	lea    -0x30(%edx),%esi
  800ada:	89 f3                	mov    %esi,%ebx
  800adc:	80 fb 09             	cmp    $0x9,%bl
  800adf:	76 df                	jbe    800ac0 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800ae1:	8d 72 9f             	lea    -0x61(%edx),%esi
  800ae4:	89 f3                	mov    %esi,%ebx
  800ae6:	80 fb 19             	cmp    $0x19,%bl
  800ae9:	77 08                	ja     800af3 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800aeb:	0f be d2             	movsbl %dl,%edx
  800aee:	83 ea 57             	sub    $0x57,%edx
  800af1:	eb d3                	jmp    800ac6 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800af3:	8d 72 bf             	lea    -0x41(%edx),%esi
  800af6:	89 f3                	mov    %esi,%ebx
  800af8:	80 fb 19             	cmp    $0x19,%bl
  800afb:	77 08                	ja     800b05 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800afd:	0f be d2             	movsbl %dl,%edx
  800b00:	83 ea 37             	sub    $0x37,%edx
  800b03:	eb c1                	jmp    800ac6 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b05:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b09:	74 05                	je     800b10 <strtol+0xd0>
		*endptr = (char *) s;
  800b0b:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b0e:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b10:	89 c2                	mov    %eax,%edx
  800b12:	f7 da                	neg    %edx
  800b14:	85 ff                	test   %edi,%edi
  800b16:	0f 45 c2             	cmovne %edx,%eax
}
  800b19:	5b                   	pop    %ebx
  800b1a:	5e                   	pop    %esi
  800b1b:	5f                   	pop    %edi
  800b1c:	5d                   	pop    %ebp
  800b1d:	c3                   	ret    

00800b1e <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b1e:	f3 0f 1e fb          	endbr32 
  800b22:	55                   	push   %ebp
  800b23:	89 e5                	mov    %esp,%ebp
  800b25:	57                   	push   %edi
  800b26:	56                   	push   %esi
  800b27:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b28:	b8 00 00 00 00       	mov    $0x0,%eax
  800b2d:	8b 55 08             	mov    0x8(%ebp),%edx
  800b30:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b33:	89 c3                	mov    %eax,%ebx
  800b35:	89 c7                	mov    %eax,%edi
  800b37:	89 c6                	mov    %eax,%esi
  800b39:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b3b:	5b                   	pop    %ebx
  800b3c:	5e                   	pop    %esi
  800b3d:	5f                   	pop    %edi
  800b3e:	5d                   	pop    %ebp
  800b3f:	c3                   	ret    

00800b40 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b40:	f3 0f 1e fb          	endbr32 
  800b44:	55                   	push   %ebp
  800b45:	89 e5                	mov    %esp,%ebp
  800b47:	57                   	push   %edi
  800b48:	56                   	push   %esi
  800b49:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b4a:	ba 00 00 00 00       	mov    $0x0,%edx
  800b4f:	b8 01 00 00 00       	mov    $0x1,%eax
  800b54:	89 d1                	mov    %edx,%ecx
  800b56:	89 d3                	mov    %edx,%ebx
  800b58:	89 d7                	mov    %edx,%edi
  800b5a:	89 d6                	mov    %edx,%esi
  800b5c:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800b5e:	5b                   	pop    %ebx
  800b5f:	5e                   	pop    %esi
  800b60:	5f                   	pop    %edi
  800b61:	5d                   	pop    %ebp
  800b62:	c3                   	ret    

00800b63 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800b63:	f3 0f 1e fb          	endbr32 
  800b67:	55                   	push   %ebp
  800b68:	89 e5                	mov    %esp,%ebp
  800b6a:	57                   	push   %edi
  800b6b:	56                   	push   %esi
  800b6c:	53                   	push   %ebx
  800b6d:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800b70:	b9 00 00 00 00       	mov    $0x0,%ecx
  800b75:	8b 55 08             	mov    0x8(%ebp),%edx
  800b78:	b8 03 00 00 00       	mov    $0x3,%eax
  800b7d:	89 cb                	mov    %ecx,%ebx
  800b7f:	89 cf                	mov    %ecx,%edi
  800b81:	89 ce                	mov    %ecx,%esi
  800b83:	cd 30                	int    $0x30
	if(check && ret > 0)
  800b85:	85 c0                	test   %eax,%eax
  800b87:	7f 08                	jg     800b91 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800b89:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800b8c:	5b                   	pop    %ebx
  800b8d:	5e                   	pop    %esi
  800b8e:	5f                   	pop    %edi
  800b8f:	5d                   	pop    %ebp
  800b90:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800b91:	83 ec 0c             	sub    $0xc,%esp
  800b94:	50                   	push   %eax
  800b95:	6a 03                	push   $0x3
  800b97:	68 7f 26 80 00       	push   $0x80267f
  800b9c:	6a 23                	push   $0x23
  800b9e:	68 9c 26 80 00       	push   $0x80269c
  800ba3:	e8 f3 13 00 00       	call   801f9b <_panic>

00800ba8 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800ba8:	f3 0f 1e fb          	endbr32 
  800bac:	55                   	push   %ebp
  800bad:	89 e5                	mov    %esp,%ebp
  800baf:	57                   	push   %edi
  800bb0:	56                   	push   %esi
  800bb1:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bb2:	ba 00 00 00 00       	mov    $0x0,%edx
  800bb7:	b8 02 00 00 00       	mov    $0x2,%eax
  800bbc:	89 d1                	mov    %edx,%ecx
  800bbe:	89 d3                	mov    %edx,%ebx
  800bc0:	89 d7                	mov    %edx,%edi
  800bc2:	89 d6                	mov    %edx,%esi
  800bc4:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800bc6:	5b                   	pop    %ebx
  800bc7:	5e                   	pop    %esi
  800bc8:	5f                   	pop    %edi
  800bc9:	5d                   	pop    %ebp
  800bca:	c3                   	ret    

00800bcb <sys_yield>:

void
sys_yield(void)
{
  800bcb:	f3 0f 1e fb          	endbr32 
  800bcf:	55                   	push   %ebp
  800bd0:	89 e5                	mov    %esp,%ebp
  800bd2:	57                   	push   %edi
  800bd3:	56                   	push   %esi
  800bd4:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bd5:	ba 00 00 00 00       	mov    $0x0,%edx
  800bda:	b8 0b 00 00 00       	mov    $0xb,%eax
  800bdf:	89 d1                	mov    %edx,%ecx
  800be1:	89 d3                	mov    %edx,%ebx
  800be3:	89 d7                	mov    %edx,%edi
  800be5:	89 d6                	mov    %edx,%esi
  800be7:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800be9:	5b                   	pop    %ebx
  800bea:	5e                   	pop    %esi
  800beb:	5f                   	pop    %edi
  800bec:	5d                   	pop    %ebp
  800bed:	c3                   	ret    

00800bee <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800bee:	f3 0f 1e fb          	endbr32 
  800bf2:	55                   	push   %ebp
  800bf3:	89 e5                	mov    %esp,%ebp
  800bf5:	57                   	push   %edi
  800bf6:	56                   	push   %esi
  800bf7:	53                   	push   %ebx
  800bf8:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bfb:	be 00 00 00 00       	mov    $0x0,%esi
  800c00:	8b 55 08             	mov    0x8(%ebp),%edx
  800c03:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c06:	b8 04 00 00 00       	mov    $0x4,%eax
  800c0b:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c0e:	89 f7                	mov    %esi,%edi
  800c10:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c12:	85 c0                	test   %eax,%eax
  800c14:	7f 08                	jg     800c1e <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c16:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c19:	5b                   	pop    %ebx
  800c1a:	5e                   	pop    %esi
  800c1b:	5f                   	pop    %edi
  800c1c:	5d                   	pop    %ebp
  800c1d:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c1e:	83 ec 0c             	sub    $0xc,%esp
  800c21:	50                   	push   %eax
  800c22:	6a 04                	push   $0x4
  800c24:	68 7f 26 80 00       	push   $0x80267f
  800c29:	6a 23                	push   $0x23
  800c2b:	68 9c 26 80 00       	push   $0x80269c
  800c30:	e8 66 13 00 00       	call   801f9b <_panic>

00800c35 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c35:	f3 0f 1e fb          	endbr32 
  800c39:	55                   	push   %ebp
  800c3a:	89 e5                	mov    %esp,%ebp
  800c3c:	57                   	push   %edi
  800c3d:	56                   	push   %esi
  800c3e:	53                   	push   %ebx
  800c3f:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c42:	8b 55 08             	mov    0x8(%ebp),%edx
  800c45:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c48:	b8 05 00 00 00       	mov    $0x5,%eax
  800c4d:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c50:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c53:	8b 75 18             	mov    0x18(%ebp),%esi
  800c56:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c58:	85 c0                	test   %eax,%eax
  800c5a:	7f 08                	jg     800c64 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c5c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c5f:	5b                   	pop    %ebx
  800c60:	5e                   	pop    %esi
  800c61:	5f                   	pop    %edi
  800c62:	5d                   	pop    %ebp
  800c63:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c64:	83 ec 0c             	sub    $0xc,%esp
  800c67:	50                   	push   %eax
  800c68:	6a 05                	push   $0x5
  800c6a:	68 7f 26 80 00       	push   $0x80267f
  800c6f:	6a 23                	push   $0x23
  800c71:	68 9c 26 80 00       	push   $0x80269c
  800c76:	e8 20 13 00 00       	call   801f9b <_panic>

00800c7b <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800c7b:	f3 0f 1e fb          	endbr32 
  800c7f:	55                   	push   %ebp
  800c80:	89 e5                	mov    %esp,%ebp
  800c82:	57                   	push   %edi
  800c83:	56                   	push   %esi
  800c84:	53                   	push   %ebx
  800c85:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c88:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c8d:	8b 55 08             	mov    0x8(%ebp),%edx
  800c90:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c93:	b8 06 00 00 00       	mov    $0x6,%eax
  800c98:	89 df                	mov    %ebx,%edi
  800c9a:	89 de                	mov    %ebx,%esi
  800c9c:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c9e:	85 c0                	test   %eax,%eax
  800ca0:	7f 08                	jg     800caa <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800ca2:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ca5:	5b                   	pop    %ebx
  800ca6:	5e                   	pop    %esi
  800ca7:	5f                   	pop    %edi
  800ca8:	5d                   	pop    %ebp
  800ca9:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800caa:	83 ec 0c             	sub    $0xc,%esp
  800cad:	50                   	push   %eax
  800cae:	6a 06                	push   $0x6
  800cb0:	68 7f 26 80 00       	push   $0x80267f
  800cb5:	6a 23                	push   $0x23
  800cb7:	68 9c 26 80 00       	push   $0x80269c
  800cbc:	e8 da 12 00 00       	call   801f9b <_panic>

00800cc1 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800cc1:	f3 0f 1e fb          	endbr32 
  800cc5:	55                   	push   %ebp
  800cc6:	89 e5                	mov    %esp,%ebp
  800cc8:	57                   	push   %edi
  800cc9:	56                   	push   %esi
  800cca:	53                   	push   %ebx
  800ccb:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cce:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cd3:	8b 55 08             	mov    0x8(%ebp),%edx
  800cd6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cd9:	b8 08 00 00 00       	mov    $0x8,%eax
  800cde:	89 df                	mov    %ebx,%edi
  800ce0:	89 de                	mov    %ebx,%esi
  800ce2:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ce4:	85 c0                	test   %eax,%eax
  800ce6:	7f 08                	jg     800cf0 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800ce8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ceb:	5b                   	pop    %ebx
  800cec:	5e                   	pop    %esi
  800ced:	5f                   	pop    %edi
  800cee:	5d                   	pop    %ebp
  800cef:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cf0:	83 ec 0c             	sub    $0xc,%esp
  800cf3:	50                   	push   %eax
  800cf4:	6a 08                	push   $0x8
  800cf6:	68 7f 26 80 00       	push   $0x80267f
  800cfb:	6a 23                	push   $0x23
  800cfd:	68 9c 26 80 00       	push   $0x80269c
  800d02:	e8 94 12 00 00       	call   801f9b <_panic>

00800d07 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d07:	f3 0f 1e fb          	endbr32 
  800d0b:	55                   	push   %ebp
  800d0c:	89 e5                	mov    %esp,%ebp
  800d0e:	57                   	push   %edi
  800d0f:	56                   	push   %esi
  800d10:	53                   	push   %ebx
  800d11:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d14:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d19:	8b 55 08             	mov    0x8(%ebp),%edx
  800d1c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d1f:	b8 09 00 00 00       	mov    $0x9,%eax
  800d24:	89 df                	mov    %ebx,%edi
  800d26:	89 de                	mov    %ebx,%esi
  800d28:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d2a:	85 c0                	test   %eax,%eax
  800d2c:	7f 08                	jg     800d36 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d2e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d31:	5b                   	pop    %ebx
  800d32:	5e                   	pop    %esi
  800d33:	5f                   	pop    %edi
  800d34:	5d                   	pop    %ebp
  800d35:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d36:	83 ec 0c             	sub    $0xc,%esp
  800d39:	50                   	push   %eax
  800d3a:	6a 09                	push   $0x9
  800d3c:	68 7f 26 80 00       	push   $0x80267f
  800d41:	6a 23                	push   $0x23
  800d43:	68 9c 26 80 00       	push   $0x80269c
  800d48:	e8 4e 12 00 00       	call   801f9b <_panic>

00800d4d <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d4d:	f3 0f 1e fb          	endbr32 
  800d51:	55                   	push   %ebp
  800d52:	89 e5                	mov    %esp,%ebp
  800d54:	57                   	push   %edi
  800d55:	56                   	push   %esi
  800d56:	53                   	push   %ebx
  800d57:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d5a:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d5f:	8b 55 08             	mov    0x8(%ebp),%edx
  800d62:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d65:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d6a:	89 df                	mov    %ebx,%edi
  800d6c:	89 de                	mov    %ebx,%esi
  800d6e:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d70:	85 c0                	test   %eax,%eax
  800d72:	7f 08                	jg     800d7c <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800d74:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d77:	5b                   	pop    %ebx
  800d78:	5e                   	pop    %esi
  800d79:	5f                   	pop    %edi
  800d7a:	5d                   	pop    %ebp
  800d7b:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d7c:	83 ec 0c             	sub    $0xc,%esp
  800d7f:	50                   	push   %eax
  800d80:	6a 0a                	push   $0xa
  800d82:	68 7f 26 80 00       	push   $0x80267f
  800d87:	6a 23                	push   $0x23
  800d89:	68 9c 26 80 00       	push   $0x80269c
  800d8e:	e8 08 12 00 00       	call   801f9b <_panic>

00800d93 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800d93:	f3 0f 1e fb          	endbr32 
  800d97:	55                   	push   %ebp
  800d98:	89 e5                	mov    %esp,%ebp
  800d9a:	57                   	push   %edi
  800d9b:	56                   	push   %esi
  800d9c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d9d:	8b 55 08             	mov    0x8(%ebp),%edx
  800da0:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da3:	b8 0c 00 00 00       	mov    $0xc,%eax
  800da8:	be 00 00 00 00       	mov    $0x0,%esi
  800dad:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800db0:	8b 7d 14             	mov    0x14(%ebp),%edi
  800db3:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800db5:	5b                   	pop    %ebx
  800db6:	5e                   	pop    %esi
  800db7:	5f                   	pop    %edi
  800db8:	5d                   	pop    %ebp
  800db9:	c3                   	ret    

00800dba <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800dba:	f3 0f 1e fb          	endbr32 
  800dbe:	55                   	push   %ebp
  800dbf:	89 e5                	mov    %esp,%ebp
  800dc1:	57                   	push   %edi
  800dc2:	56                   	push   %esi
  800dc3:	53                   	push   %ebx
  800dc4:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dc7:	b9 00 00 00 00       	mov    $0x0,%ecx
  800dcc:	8b 55 08             	mov    0x8(%ebp),%edx
  800dcf:	b8 0d 00 00 00       	mov    $0xd,%eax
  800dd4:	89 cb                	mov    %ecx,%ebx
  800dd6:	89 cf                	mov    %ecx,%edi
  800dd8:	89 ce                	mov    %ecx,%esi
  800dda:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ddc:	85 c0                	test   %eax,%eax
  800dde:	7f 08                	jg     800de8 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800de0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800de3:	5b                   	pop    %ebx
  800de4:	5e                   	pop    %esi
  800de5:	5f                   	pop    %edi
  800de6:	5d                   	pop    %ebp
  800de7:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800de8:	83 ec 0c             	sub    $0xc,%esp
  800deb:	50                   	push   %eax
  800dec:	6a 0d                	push   $0xd
  800dee:	68 7f 26 80 00       	push   $0x80267f
  800df3:	6a 23                	push   $0x23
  800df5:	68 9c 26 80 00       	push   $0x80269c
  800dfa:	e8 9c 11 00 00       	call   801f9b <_panic>

00800dff <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800dff:	f3 0f 1e fb          	endbr32 
  800e03:	55                   	push   %ebp
  800e04:	89 e5                	mov    %esp,%ebp
  800e06:	56                   	push   %esi
  800e07:	53                   	push   %ebx
  800e08:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800e0b:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e0d:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800e11:	0f 84 b2 00 00 00    	je     800ec9 <pgfault+0xca>
  800e17:	89 d8                	mov    %ebx,%eax
  800e19:	c1 e8 16             	shr    $0x16,%eax
  800e1c:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800e23:	a8 01                	test   $0x1,%al
  800e25:	0f 84 9e 00 00 00    	je     800ec9 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e2b:	89 d8                	mov    %ebx,%eax
  800e2d:	c1 e8 0c             	shr    $0xc,%eax
  800e30:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e37:	f6 c2 01             	test   $0x1,%dl
  800e3a:	0f 84 89 00 00 00    	je     800ec9 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e40:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e47:	f6 c4 08             	test   $0x8,%ah
  800e4a:	74 7d                	je     800ec9 <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800e4c:	e8 57 fd ff ff       	call   800ba8 <sys_getenvid>
  800e51:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800e53:	83 ec 04             	sub    $0x4,%esp
  800e56:	6a 07                	push   $0x7
  800e58:	68 00 f0 7f 00       	push   $0x7ff000
  800e5d:	50                   	push   %eax
  800e5e:	e8 8b fd ff ff       	call   800bee <sys_page_alloc>
	if(r<0){
  800e63:	83 c4 10             	add    $0x10,%esp
  800e66:	85 c0                	test   %eax,%eax
  800e68:	78 73                	js     800edd <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800e6a:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800e70:	83 ec 04             	sub    $0x4,%esp
  800e73:	68 00 10 00 00       	push   $0x1000
  800e78:	53                   	push   %ebx
  800e79:	68 00 f0 7f 00       	push   $0x7ff000
  800e7e:	e8 df fa ff ff       	call   800962 <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800e83:	83 c4 08             	add    $0x8,%esp
  800e86:	53                   	push   %ebx
  800e87:	56                   	push   %esi
  800e88:	e8 ee fd ff ff       	call   800c7b <sys_page_unmap>
	if(r<0)
  800e8d:	83 c4 10             	add    $0x10,%esp
  800e90:	85 c0                	test   %eax,%eax
  800e92:	78 5b                	js     800eef <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800e94:	83 ec 0c             	sub    $0xc,%esp
  800e97:	6a 07                	push   $0x7
  800e99:	53                   	push   %ebx
  800e9a:	56                   	push   %esi
  800e9b:	68 00 f0 7f 00       	push   $0x7ff000
  800ea0:	56                   	push   %esi
  800ea1:	e8 8f fd ff ff       	call   800c35 <sys_page_map>
	if(r<0)
  800ea6:	83 c4 20             	add    $0x20,%esp
  800ea9:	85 c0                	test   %eax,%eax
  800eab:	78 54                	js     800f01 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800ead:	83 ec 08             	sub    $0x8,%esp
  800eb0:	68 00 f0 7f 00       	push   $0x7ff000
  800eb5:	56                   	push   %esi
  800eb6:	e8 c0 fd ff ff       	call   800c7b <sys_page_unmap>
	if(r<0)
  800ebb:	83 c4 10             	add    $0x10,%esp
  800ebe:	85 c0                	test   %eax,%eax
  800ec0:	78 51                	js     800f13 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800ec2:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800ec5:	5b                   	pop    %ebx
  800ec6:	5e                   	pop    %esi
  800ec7:	5d                   	pop    %ebp
  800ec8:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800ec9:	83 ec 04             	sub    $0x4,%esp
  800ecc:	68 ac 26 80 00       	push   $0x8026ac
  800ed1:	6a 2c                	push   $0x2c
  800ed3:	68 5b 27 80 00       	push   $0x80275b
  800ed8:	e8 be 10 00 00       	call   801f9b <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800edd:	50                   	push   %eax
  800ede:	68 ec 26 80 00       	push   $0x8026ec
  800ee3:	6a 31                	push   $0x31
  800ee5:	68 5b 27 80 00       	push   $0x80275b
  800eea:	e8 ac 10 00 00       	call   801f9b <_panic>
	panic("pgfault: page unmap failed %e", r);
  800eef:	50                   	push   %eax
  800ef0:	68 66 27 80 00       	push   $0x802766
  800ef5:	6a 3b                	push   $0x3b
  800ef7:	68 5b 27 80 00       	push   $0x80275b
  800efc:	e8 9a 10 00 00       	call   801f9b <_panic>
	panic("pgfault: page map failed %e", r);
  800f01:	50                   	push   %eax
  800f02:	68 84 27 80 00       	push   $0x802784
  800f07:	6a 3e                	push   $0x3e
  800f09:	68 5b 27 80 00       	push   $0x80275b
  800f0e:	e8 88 10 00 00       	call   801f9b <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f13:	50                   	push   %eax
  800f14:	68 66 27 80 00       	push   $0x802766
  800f19:	6a 41                	push   $0x41
  800f1b:	68 5b 27 80 00       	push   $0x80275b
  800f20:	e8 76 10 00 00       	call   801f9b <_panic>

00800f25 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  800f25:	f3 0f 1e fb          	endbr32 
  800f29:	55                   	push   %ebp
  800f2a:	89 e5                	mov    %esp,%ebp
  800f2c:	57                   	push   %edi
  800f2d:	56                   	push   %esi
  800f2e:	53                   	push   %ebx
  800f2f:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  800f32:	68 ff 0d 80 00       	push   $0x800dff
  800f37:	e8 a9 10 00 00       	call   801fe5 <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  800f3c:	b8 07 00 00 00       	mov    $0x7,%eax
  800f41:	cd 30                	int    $0x30
  800f43:	89 c7                	mov    %eax,%edi
  800f45:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  800f48:	83 c4 10             	add    $0x10,%esp
  800f4b:	85 c0                	test   %eax,%eax
  800f4d:	0f 8e 9d 01 00 00    	jle    8010f0 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800f53:	bb 00 00 80 00       	mov    $0x800000,%ebx
  800f58:	eb 5b                	jmp    800fb5 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  800f5a:	83 ec 0c             	sub    $0xc,%esp
  800f5d:	68 07 0e 00 00       	push   $0xe07
  800f62:	56                   	push   %esi
  800f63:	ff 75 e4             	pushl  -0x1c(%ebp)
  800f66:	56                   	push   %esi
  800f67:	6a 00                	push   $0x0
  800f69:	e8 c7 fc ff ff       	call   800c35 <sys_page_map>
  800f6e:	83 c4 20             	add    $0x20,%esp
  800f71:	eb 30                	jmp    800fa3 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  800f73:	83 ec 04             	sub    $0x4,%esp
  800f76:	68 a0 27 80 00       	push   $0x8027a0
  800f7b:	6a 63                	push   $0x63
  800f7d:	68 5b 27 80 00       	push   $0x80275b
  800f82:	e8 14 10 00 00       	call   801f9b <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  800f87:	83 ec 0c             	sub    $0xc,%esp
  800f8a:	6a 05                	push   $0x5
  800f8c:	56                   	push   %esi
  800f8d:	ff 75 e4             	pushl  -0x1c(%ebp)
  800f90:	56                   	push   %esi
  800f91:	6a 00                	push   $0x0
  800f93:	e8 9d fc ff ff       	call   800c35 <sys_page_map>
            if(r < 0)
  800f98:	83 c4 20             	add    $0x20,%esp
  800f9b:	85 c0                	test   %eax,%eax
  800f9d:	0f 88 ac 00 00 00    	js     80104f <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800fa3:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  800fa9:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  800faf:	0f 84 ae 00 00 00    	je     801063 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800fb5:	89 d8                	mov    %ebx,%eax
  800fb7:	c1 e8 16             	shr    $0x16,%eax
  800fba:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800fc1:	a8 01                	test   $0x1,%al
  800fc3:	74 de                	je     800fa3 <fork+0x7e>
			pn=PGNUM(pageVa);
  800fc5:	89 d8                	mov    %ebx,%eax
  800fc7:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800fca:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  800fd1:	f6 c2 01             	test   $0x1,%dl
  800fd4:	74 cd                	je     800fa3 <fork+0x7e>
  800fd6:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  800fdd:	f6 c2 04             	test   $0x4,%dl
  800fe0:	74 c1                	je     800fa3 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  800fe2:	89 c6                	mov    %eax,%esi
  800fe4:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  800fe7:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  800fee:	f6 c4 04             	test   $0x4,%ah
  800ff1:	0f 85 63 ff ff ff    	jne    800f5a <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  800ff7:	a9 02 08 00 00       	test   $0x802,%eax
  800ffc:	74 89                	je     800f87 <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  800ffe:	83 ec 0c             	sub    $0xc,%esp
  801001:	68 05 08 00 00       	push   $0x805
  801006:	56                   	push   %esi
  801007:	ff 75 e4             	pushl  -0x1c(%ebp)
  80100a:	56                   	push   %esi
  80100b:	6a 00                	push   $0x0
  80100d:	e8 23 fc ff ff       	call   800c35 <sys_page_map>
            if(r < 0)
  801012:	83 c4 20             	add    $0x20,%esp
  801015:	85 c0                	test   %eax,%eax
  801017:	0f 88 56 ff ff ff    	js     800f73 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  80101d:	83 ec 0c             	sub    $0xc,%esp
  801020:	68 05 08 00 00       	push   $0x805
  801025:	56                   	push   %esi
  801026:	6a 00                	push   $0x0
  801028:	56                   	push   %esi
  801029:	6a 00                	push   $0x0
  80102b:	e8 05 fc ff ff       	call   800c35 <sys_page_map>
            if(r < 0)
  801030:	83 c4 20             	add    $0x20,%esp
  801033:	85 c0                	test   %eax,%eax
  801035:	0f 89 68 ff ff ff    	jns    800fa3 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  80103b:	83 ec 04             	sub    $0x4,%esp
  80103e:	68 a0 27 80 00       	push   $0x8027a0
  801043:	6a 66                	push   $0x66
  801045:	68 5b 27 80 00       	push   $0x80275b
  80104a:	e8 4c 0f 00 00       	call   801f9b <_panic>
                panic("duppage: sys_page_map fail\n");
  80104f:	83 ec 04             	sub    $0x4,%esp
  801052:	68 a0 27 80 00       	push   $0x8027a0
  801057:	6a 6c                	push   $0x6c
  801059:	68 5b 27 80 00       	push   $0x80275b
  80105e:	e8 38 0f 00 00       	call   801f9b <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  801063:	83 ec 04             	sub    $0x4,%esp
  801066:	6a 07                	push   $0x7
  801068:	68 00 f0 bf ee       	push   $0xeebff000
  80106d:	57                   	push   %edi
  80106e:	e8 7b fb ff ff       	call   800bee <sys_page_alloc>
		if(flag<0){
  801073:	83 c4 10             	add    $0x10,%esp
  801076:	85 c0                	test   %eax,%eax
  801078:	78 31                	js     8010ab <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  80107a:	83 ec 08             	sub    $0x8,%esp
  80107d:	68 5f 20 80 00       	push   $0x80205f
  801082:	57                   	push   %edi
  801083:	e8 c5 fc ff ff       	call   800d4d <sys_env_set_pgfault_upcall>
		if(flag<0){
  801088:	83 c4 10             	add    $0x10,%esp
  80108b:	85 c0                	test   %eax,%eax
  80108d:	78 33                	js     8010c2 <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  80108f:	83 ec 08             	sub    $0x8,%esp
  801092:	6a 02                	push   $0x2
  801094:	57                   	push   %edi
  801095:	e8 27 fc ff ff       	call   800cc1 <sys_env_set_status>
		if(flag<0){
  80109a:	83 c4 10             	add    $0x10,%esp
  80109d:	85 c0                	test   %eax,%eax
  80109f:	78 38                	js     8010d9 <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  8010a1:	89 f8                	mov    %edi,%eax
  8010a3:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010a6:	5b                   	pop    %ebx
  8010a7:	5e                   	pop    %esi
  8010a8:	5f                   	pop    %edi
  8010a9:	5d                   	pop    %ebp
  8010aa:	c3                   	ret    
			panic("panic by alloc page");
  8010ab:	83 ec 04             	sub    $0x4,%esp
  8010ae:	68 bc 27 80 00       	push   $0x8027bc
  8010b3:	68 98 00 00 00       	push   $0x98
  8010b8:	68 5b 27 80 00       	push   $0x80275b
  8010bd:	e8 d9 0e 00 00       	call   801f9b <_panic>
			panic("panic by set pgfault upcall faction");
  8010c2:	83 ec 04             	sub    $0x4,%esp
  8010c5:	68 10 27 80 00       	push   $0x802710
  8010ca:	68 9e 00 00 00       	push   $0x9e
  8010cf:	68 5b 27 80 00       	push   $0x80275b
  8010d4:	e8 c2 0e 00 00       	call   801f9b <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  8010d9:	83 ec 04             	sub    $0x4,%esp
  8010dc:	68 34 27 80 00       	push   $0x802734
  8010e1:	68 a3 00 00 00       	push   $0xa3
  8010e6:	68 5b 27 80 00       	push   $0x80275b
  8010eb:	e8 ab 0e 00 00       	call   801f9b <_panic>
	else if(envid==0){
  8010f0:	75 19                	jne    80110b <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  8010f2:	e8 b1 fa ff ff       	call   800ba8 <sys_getenvid>
  8010f7:	25 ff 03 00 00       	and    $0x3ff,%eax
  8010fc:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8010ff:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801104:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  801109:	eb 96                	jmp    8010a1 <fork+0x17c>
		panic("panic by alloc envid");
  80110b:	83 ec 04             	sub    $0x4,%esp
  80110e:	68 d0 27 80 00       	push   $0x8027d0
  801113:	68 ad 00 00 00       	push   $0xad
  801118:	68 5b 27 80 00       	push   $0x80275b
  80111d:	e8 79 0e 00 00       	call   801f9b <_panic>

00801122 <sfork>:

// Challenge!
int
sfork(void)
{
  801122:	f3 0f 1e fb          	endbr32 
  801126:	55                   	push   %ebp
  801127:	89 e5                	mov    %esp,%ebp
  801129:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  80112c:	68 e5 27 80 00       	push   $0x8027e5
  801131:	68 b7 00 00 00       	push   $0xb7
  801136:	68 5b 27 80 00       	push   $0x80275b
  80113b:	e8 5b 0e 00 00       	call   801f9b <_panic>

00801140 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801140:	f3 0f 1e fb          	endbr32 
  801144:	55                   	push   %ebp
  801145:	89 e5                	mov    %esp,%ebp
  801147:	56                   	push   %esi
  801148:	53                   	push   %ebx
  801149:	8b 75 08             	mov    0x8(%ebp),%esi
  80114c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80114f:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801152:	85 c0                	test   %eax,%eax
  801154:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801159:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  80115c:	83 ec 0c             	sub    $0xc,%esp
  80115f:	50                   	push   %eax
  801160:	e8 55 fc ff ff       	call   800dba <sys_ipc_recv>
  801165:	83 c4 10             	add    $0x10,%esp
  801168:	85 c0                	test   %eax,%eax
  80116a:	78 3f                	js     8011ab <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  80116c:	e8 37 fa ff ff       	call   800ba8 <sys_getenvid>
  801171:	25 ff 03 00 00       	and    $0x3ff,%eax
  801176:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801179:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  80117f:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801185:	85 f6                	test   %esi,%esi
  801187:	74 05                	je     80118e <ipc_recv+0x4e>
  801189:	8b 42 74             	mov    0x74(%edx),%eax
  80118c:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  80118e:	85 db                	test   %ebx,%ebx
  801190:	74 0a                	je     80119c <ipc_recv+0x5c>
  801192:	a1 04 40 80 00       	mov    0x804004,%eax
  801197:	8b 40 78             	mov    0x78(%eax),%eax
  80119a:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  80119c:	a1 04 40 80 00       	mov    0x804004,%eax
  8011a1:	8b 40 70             	mov    0x70(%eax),%eax
}
  8011a4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8011a7:	5b                   	pop    %ebx
  8011a8:	5e                   	pop    %esi
  8011a9:	5d                   	pop    %ebp
  8011aa:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  8011ab:	85 f6                	test   %esi,%esi
  8011ad:	74 06                	je     8011b5 <ipc_recv+0x75>
  8011af:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  8011b5:	85 db                	test   %ebx,%ebx
  8011b7:	74 eb                	je     8011a4 <ipc_recv+0x64>
  8011b9:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8011bf:	eb e3                	jmp    8011a4 <ipc_recv+0x64>

008011c1 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  8011c1:	f3 0f 1e fb          	endbr32 
  8011c5:	55                   	push   %ebp
  8011c6:	89 e5                	mov    %esp,%ebp
  8011c8:	57                   	push   %edi
  8011c9:	56                   	push   %esi
  8011ca:	53                   	push   %ebx
  8011cb:	83 ec 0c             	sub    $0xc,%esp
  8011ce:	8b 7d 08             	mov    0x8(%ebp),%edi
  8011d1:	8b 75 0c             	mov    0xc(%ebp),%esi
  8011d4:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  8011d7:	85 db                	test   %ebx,%ebx
  8011d9:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  8011de:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  8011e1:	ff 75 14             	pushl  0x14(%ebp)
  8011e4:	53                   	push   %ebx
  8011e5:	56                   	push   %esi
  8011e6:	57                   	push   %edi
  8011e7:	e8 a7 fb ff ff       	call   800d93 <sys_ipc_try_send>
  8011ec:	83 c4 10             	add    $0x10,%esp
  8011ef:	85 c0                	test   %eax,%eax
  8011f1:	79 1e                	jns    801211 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  8011f3:	83 f8 f9             	cmp    $0xfffffff9,%eax
  8011f6:	75 07                	jne    8011ff <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  8011f8:	e8 ce f9 ff ff       	call   800bcb <sys_yield>
  8011fd:	eb e2                	jmp    8011e1 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  8011ff:	50                   	push   %eax
  801200:	68 fb 27 80 00       	push   $0x8027fb
  801205:	6a 3b                	push   $0x3b
  801207:	68 0f 28 80 00       	push   $0x80280f
  80120c:	e8 8a 0d 00 00       	call   801f9b <_panic>
	}
}
  801211:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801214:	5b                   	pop    %ebx
  801215:	5e                   	pop    %esi
  801216:	5f                   	pop    %edi
  801217:	5d                   	pop    %ebp
  801218:	c3                   	ret    

00801219 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801219:	f3 0f 1e fb          	endbr32 
  80121d:	55                   	push   %ebp
  80121e:	89 e5                	mov    %esp,%ebp
  801220:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801223:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801228:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80122b:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801231:	8b 52 50             	mov    0x50(%edx),%edx
  801234:	39 ca                	cmp    %ecx,%edx
  801236:	74 11                	je     801249 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801238:	83 c0 01             	add    $0x1,%eax
  80123b:	3d 00 04 00 00       	cmp    $0x400,%eax
  801240:	75 e6                	jne    801228 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801242:	b8 00 00 00 00       	mov    $0x0,%eax
  801247:	eb 0b                	jmp    801254 <ipc_find_env+0x3b>
			return envs[i].env_id;
  801249:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80124c:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801251:	8b 40 48             	mov    0x48(%eax),%eax
}
  801254:	5d                   	pop    %ebp
  801255:	c3                   	ret    

00801256 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  801256:	f3 0f 1e fb          	endbr32 
  80125a:	55                   	push   %ebp
  80125b:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80125d:	8b 45 08             	mov    0x8(%ebp),%eax
  801260:	05 00 00 00 30       	add    $0x30000000,%eax
  801265:	c1 e8 0c             	shr    $0xc,%eax
}
  801268:	5d                   	pop    %ebp
  801269:	c3                   	ret    

0080126a <fd2data>:

char*
fd2data(struct Fd *fd)
{
  80126a:	f3 0f 1e fb          	endbr32 
  80126e:	55                   	push   %ebp
  80126f:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801271:	8b 45 08             	mov    0x8(%ebp),%eax
  801274:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  801279:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  80127e:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801283:	5d                   	pop    %ebp
  801284:	c3                   	ret    

00801285 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  801285:	f3 0f 1e fb          	endbr32 
  801289:	55                   	push   %ebp
  80128a:	89 e5                	mov    %esp,%ebp
  80128c:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  801291:	89 c2                	mov    %eax,%edx
  801293:	c1 ea 16             	shr    $0x16,%edx
  801296:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  80129d:	f6 c2 01             	test   $0x1,%dl
  8012a0:	74 2d                	je     8012cf <fd_alloc+0x4a>
  8012a2:	89 c2                	mov    %eax,%edx
  8012a4:	c1 ea 0c             	shr    $0xc,%edx
  8012a7:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8012ae:	f6 c2 01             	test   $0x1,%dl
  8012b1:	74 1c                	je     8012cf <fd_alloc+0x4a>
  8012b3:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  8012b8:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  8012bd:	75 d2                	jne    801291 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  8012bf:	8b 45 08             	mov    0x8(%ebp),%eax
  8012c2:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  8012c8:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  8012cd:	eb 0a                	jmp    8012d9 <fd_alloc+0x54>
			*fd_store = fd;
  8012cf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8012d2:	89 01                	mov    %eax,(%ecx)
			return 0;
  8012d4:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8012d9:	5d                   	pop    %ebp
  8012da:	c3                   	ret    

008012db <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  8012db:	f3 0f 1e fb          	endbr32 
  8012df:	55                   	push   %ebp
  8012e0:	89 e5                	mov    %esp,%ebp
  8012e2:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  8012e5:	83 f8 1f             	cmp    $0x1f,%eax
  8012e8:	77 30                	ja     80131a <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  8012ea:	c1 e0 0c             	shl    $0xc,%eax
  8012ed:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  8012f2:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  8012f8:	f6 c2 01             	test   $0x1,%dl
  8012fb:	74 24                	je     801321 <fd_lookup+0x46>
  8012fd:	89 c2                	mov    %eax,%edx
  8012ff:	c1 ea 0c             	shr    $0xc,%edx
  801302:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801309:	f6 c2 01             	test   $0x1,%dl
  80130c:	74 1a                	je     801328 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  80130e:	8b 55 0c             	mov    0xc(%ebp),%edx
  801311:	89 02                	mov    %eax,(%edx)
	return 0;
  801313:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801318:	5d                   	pop    %ebp
  801319:	c3                   	ret    
		return -E_INVAL;
  80131a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80131f:	eb f7                	jmp    801318 <fd_lookup+0x3d>
		return -E_INVAL;
  801321:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801326:	eb f0                	jmp    801318 <fd_lookup+0x3d>
  801328:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80132d:	eb e9                	jmp    801318 <fd_lookup+0x3d>

0080132f <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  80132f:	f3 0f 1e fb          	endbr32 
  801333:	55                   	push   %ebp
  801334:	89 e5                	mov    %esp,%ebp
  801336:	83 ec 08             	sub    $0x8,%esp
  801339:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80133c:	ba 98 28 80 00       	mov    $0x802898,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801341:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  801346:	39 08                	cmp    %ecx,(%eax)
  801348:	74 33                	je     80137d <dev_lookup+0x4e>
  80134a:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  80134d:	8b 02                	mov    (%edx),%eax
  80134f:	85 c0                	test   %eax,%eax
  801351:	75 f3                	jne    801346 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801353:	a1 04 40 80 00       	mov    0x804004,%eax
  801358:	8b 40 48             	mov    0x48(%eax),%eax
  80135b:	83 ec 04             	sub    $0x4,%esp
  80135e:	51                   	push   %ecx
  80135f:	50                   	push   %eax
  801360:	68 1c 28 80 00       	push   $0x80281c
  801365:	e8 69 ee ff ff       	call   8001d3 <cprintf>
	*dev = 0;
  80136a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80136d:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801373:	83 c4 10             	add    $0x10,%esp
  801376:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  80137b:	c9                   	leave  
  80137c:	c3                   	ret    
			*dev = devtab[i];
  80137d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801380:	89 01                	mov    %eax,(%ecx)
			return 0;
  801382:	b8 00 00 00 00       	mov    $0x0,%eax
  801387:	eb f2                	jmp    80137b <dev_lookup+0x4c>

00801389 <fd_close>:
{
  801389:	f3 0f 1e fb          	endbr32 
  80138d:	55                   	push   %ebp
  80138e:	89 e5                	mov    %esp,%ebp
  801390:	57                   	push   %edi
  801391:	56                   	push   %esi
  801392:	53                   	push   %ebx
  801393:	83 ec 24             	sub    $0x24,%esp
  801396:	8b 75 08             	mov    0x8(%ebp),%esi
  801399:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80139c:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80139f:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8013a0:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8013a6:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013a9:	50                   	push   %eax
  8013aa:	e8 2c ff ff ff       	call   8012db <fd_lookup>
  8013af:	89 c3                	mov    %eax,%ebx
  8013b1:	83 c4 10             	add    $0x10,%esp
  8013b4:	85 c0                	test   %eax,%eax
  8013b6:	78 05                	js     8013bd <fd_close+0x34>
	    || fd != fd2)
  8013b8:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  8013bb:	74 16                	je     8013d3 <fd_close+0x4a>
		return (must_exist ? r : 0);
  8013bd:	89 f8                	mov    %edi,%eax
  8013bf:	84 c0                	test   %al,%al
  8013c1:	b8 00 00 00 00       	mov    $0x0,%eax
  8013c6:	0f 44 d8             	cmove  %eax,%ebx
}
  8013c9:	89 d8                	mov    %ebx,%eax
  8013cb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8013ce:	5b                   	pop    %ebx
  8013cf:	5e                   	pop    %esi
  8013d0:	5f                   	pop    %edi
  8013d1:	5d                   	pop    %ebp
  8013d2:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8013d3:	83 ec 08             	sub    $0x8,%esp
  8013d6:	8d 45 e0             	lea    -0x20(%ebp),%eax
  8013d9:	50                   	push   %eax
  8013da:	ff 36                	pushl  (%esi)
  8013dc:	e8 4e ff ff ff       	call   80132f <dev_lookup>
  8013e1:	89 c3                	mov    %eax,%ebx
  8013e3:	83 c4 10             	add    $0x10,%esp
  8013e6:	85 c0                	test   %eax,%eax
  8013e8:	78 1a                	js     801404 <fd_close+0x7b>
		if (dev->dev_close)
  8013ea:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8013ed:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8013f0:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  8013f5:	85 c0                	test   %eax,%eax
  8013f7:	74 0b                	je     801404 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  8013f9:	83 ec 0c             	sub    $0xc,%esp
  8013fc:	56                   	push   %esi
  8013fd:	ff d0                	call   *%eax
  8013ff:	89 c3                	mov    %eax,%ebx
  801401:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801404:	83 ec 08             	sub    $0x8,%esp
  801407:	56                   	push   %esi
  801408:	6a 00                	push   $0x0
  80140a:	e8 6c f8 ff ff       	call   800c7b <sys_page_unmap>
	return r;
  80140f:	83 c4 10             	add    $0x10,%esp
  801412:	eb b5                	jmp    8013c9 <fd_close+0x40>

00801414 <close>:

int
close(int fdnum)
{
  801414:	f3 0f 1e fb          	endbr32 
  801418:	55                   	push   %ebp
  801419:	89 e5                	mov    %esp,%ebp
  80141b:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80141e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801421:	50                   	push   %eax
  801422:	ff 75 08             	pushl  0x8(%ebp)
  801425:	e8 b1 fe ff ff       	call   8012db <fd_lookup>
  80142a:	83 c4 10             	add    $0x10,%esp
  80142d:	85 c0                	test   %eax,%eax
  80142f:	79 02                	jns    801433 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801431:	c9                   	leave  
  801432:	c3                   	ret    
		return fd_close(fd, 1);
  801433:	83 ec 08             	sub    $0x8,%esp
  801436:	6a 01                	push   $0x1
  801438:	ff 75 f4             	pushl  -0xc(%ebp)
  80143b:	e8 49 ff ff ff       	call   801389 <fd_close>
  801440:	83 c4 10             	add    $0x10,%esp
  801443:	eb ec                	jmp    801431 <close+0x1d>

00801445 <close_all>:

void
close_all(void)
{
  801445:	f3 0f 1e fb          	endbr32 
  801449:	55                   	push   %ebp
  80144a:	89 e5                	mov    %esp,%ebp
  80144c:	53                   	push   %ebx
  80144d:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801450:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801455:	83 ec 0c             	sub    $0xc,%esp
  801458:	53                   	push   %ebx
  801459:	e8 b6 ff ff ff       	call   801414 <close>
	for (i = 0; i < MAXFD; i++)
  80145e:	83 c3 01             	add    $0x1,%ebx
  801461:	83 c4 10             	add    $0x10,%esp
  801464:	83 fb 20             	cmp    $0x20,%ebx
  801467:	75 ec                	jne    801455 <close_all+0x10>
}
  801469:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80146c:	c9                   	leave  
  80146d:	c3                   	ret    

0080146e <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80146e:	f3 0f 1e fb          	endbr32 
  801472:	55                   	push   %ebp
  801473:	89 e5                	mov    %esp,%ebp
  801475:	57                   	push   %edi
  801476:	56                   	push   %esi
  801477:	53                   	push   %ebx
  801478:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  80147b:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80147e:	50                   	push   %eax
  80147f:	ff 75 08             	pushl  0x8(%ebp)
  801482:	e8 54 fe ff ff       	call   8012db <fd_lookup>
  801487:	89 c3                	mov    %eax,%ebx
  801489:	83 c4 10             	add    $0x10,%esp
  80148c:	85 c0                	test   %eax,%eax
  80148e:	0f 88 81 00 00 00    	js     801515 <dup+0xa7>
		return r;
	close(newfdnum);
  801494:	83 ec 0c             	sub    $0xc,%esp
  801497:	ff 75 0c             	pushl  0xc(%ebp)
  80149a:	e8 75 ff ff ff       	call   801414 <close>

	newfd = INDEX2FD(newfdnum);
  80149f:	8b 75 0c             	mov    0xc(%ebp),%esi
  8014a2:	c1 e6 0c             	shl    $0xc,%esi
  8014a5:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8014ab:	83 c4 04             	add    $0x4,%esp
  8014ae:	ff 75 e4             	pushl  -0x1c(%ebp)
  8014b1:	e8 b4 fd ff ff       	call   80126a <fd2data>
  8014b6:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8014b8:	89 34 24             	mov    %esi,(%esp)
  8014bb:	e8 aa fd ff ff       	call   80126a <fd2data>
  8014c0:	83 c4 10             	add    $0x10,%esp
  8014c3:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  8014c5:	89 d8                	mov    %ebx,%eax
  8014c7:	c1 e8 16             	shr    $0x16,%eax
  8014ca:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8014d1:	a8 01                	test   $0x1,%al
  8014d3:	74 11                	je     8014e6 <dup+0x78>
  8014d5:	89 d8                	mov    %ebx,%eax
  8014d7:	c1 e8 0c             	shr    $0xc,%eax
  8014da:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8014e1:	f6 c2 01             	test   $0x1,%dl
  8014e4:	75 39                	jne    80151f <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8014e6:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8014e9:	89 d0                	mov    %edx,%eax
  8014eb:	c1 e8 0c             	shr    $0xc,%eax
  8014ee:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8014f5:	83 ec 0c             	sub    $0xc,%esp
  8014f8:	25 07 0e 00 00       	and    $0xe07,%eax
  8014fd:	50                   	push   %eax
  8014fe:	56                   	push   %esi
  8014ff:	6a 00                	push   $0x0
  801501:	52                   	push   %edx
  801502:	6a 00                	push   $0x0
  801504:	e8 2c f7 ff ff       	call   800c35 <sys_page_map>
  801509:	89 c3                	mov    %eax,%ebx
  80150b:	83 c4 20             	add    $0x20,%esp
  80150e:	85 c0                	test   %eax,%eax
  801510:	78 31                	js     801543 <dup+0xd5>
		goto err;

	return newfdnum;
  801512:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801515:	89 d8                	mov    %ebx,%eax
  801517:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80151a:	5b                   	pop    %ebx
  80151b:	5e                   	pop    %esi
  80151c:	5f                   	pop    %edi
  80151d:	5d                   	pop    %ebp
  80151e:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  80151f:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801526:	83 ec 0c             	sub    $0xc,%esp
  801529:	25 07 0e 00 00       	and    $0xe07,%eax
  80152e:	50                   	push   %eax
  80152f:	57                   	push   %edi
  801530:	6a 00                	push   $0x0
  801532:	53                   	push   %ebx
  801533:	6a 00                	push   $0x0
  801535:	e8 fb f6 ff ff       	call   800c35 <sys_page_map>
  80153a:	89 c3                	mov    %eax,%ebx
  80153c:	83 c4 20             	add    $0x20,%esp
  80153f:	85 c0                	test   %eax,%eax
  801541:	79 a3                	jns    8014e6 <dup+0x78>
	sys_page_unmap(0, newfd);
  801543:	83 ec 08             	sub    $0x8,%esp
  801546:	56                   	push   %esi
  801547:	6a 00                	push   $0x0
  801549:	e8 2d f7 ff ff       	call   800c7b <sys_page_unmap>
	sys_page_unmap(0, nva);
  80154e:	83 c4 08             	add    $0x8,%esp
  801551:	57                   	push   %edi
  801552:	6a 00                	push   $0x0
  801554:	e8 22 f7 ff ff       	call   800c7b <sys_page_unmap>
	return r;
  801559:	83 c4 10             	add    $0x10,%esp
  80155c:	eb b7                	jmp    801515 <dup+0xa7>

0080155e <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80155e:	f3 0f 1e fb          	endbr32 
  801562:	55                   	push   %ebp
  801563:	89 e5                	mov    %esp,%ebp
  801565:	53                   	push   %ebx
  801566:	83 ec 1c             	sub    $0x1c,%esp
  801569:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80156c:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80156f:	50                   	push   %eax
  801570:	53                   	push   %ebx
  801571:	e8 65 fd ff ff       	call   8012db <fd_lookup>
  801576:	83 c4 10             	add    $0x10,%esp
  801579:	85 c0                	test   %eax,%eax
  80157b:	78 3f                	js     8015bc <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80157d:	83 ec 08             	sub    $0x8,%esp
  801580:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801583:	50                   	push   %eax
  801584:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801587:	ff 30                	pushl  (%eax)
  801589:	e8 a1 fd ff ff       	call   80132f <dev_lookup>
  80158e:	83 c4 10             	add    $0x10,%esp
  801591:	85 c0                	test   %eax,%eax
  801593:	78 27                	js     8015bc <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801595:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801598:	8b 42 08             	mov    0x8(%edx),%eax
  80159b:	83 e0 03             	and    $0x3,%eax
  80159e:	83 f8 01             	cmp    $0x1,%eax
  8015a1:	74 1e                	je     8015c1 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8015a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8015a6:	8b 40 08             	mov    0x8(%eax),%eax
  8015a9:	85 c0                	test   %eax,%eax
  8015ab:	74 35                	je     8015e2 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8015ad:	83 ec 04             	sub    $0x4,%esp
  8015b0:	ff 75 10             	pushl  0x10(%ebp)
  8015b3:	ff 75 0c             	pushl  0xc(%ebp)
  8015b6:	52                   	push   %edx
  8015b7:	ff d0                	call   *%eax
  8015b9:	83 c4 10             	add    $0x10,%esp
}
  8015bc:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015bf:	c9                   	leave  
  8015c0:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8015c1:	a1 04 40 80 00       	mov    0x804004,%eax
  8015c6:	8b 40 48             	mov    0x48(%eax),%eax
  8015c9:	83 ec 04             	sub    $0x4,%esp
  8015cc:	53                   	push   %ebx
  8015cd:	50                   	push   %eax
  8015ce:	68 5d 28 80 00       	push   $0x80285d
  8015d3:	e8 fb eb ff ff       	call   8001d3 <cprintf>
		return -E_INVAL;
  8015d8:	83 c4 10             	add    $0x10,%esp
  8015db:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8015e0:	eb da                	jmp    8015bc <read+0x5e>
		return -E_NOT_SUPP;
  8015e2:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8015e7:	eb d3                	jmp    8015bc <read+0x5e>

008015e9 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8015e9:	f3 0f 1e fb          	endbr32 
  8015ed:	55                   	push   %ebp
  8015ee:	89 e5                	mov    %esp,%ebp
  8015f0:	57                   	push   %edi
  8015f1:	56                   	push   %esi
  8015f2:	53                   	push   %ebx
  8015f3:	83 ec 0c             	sub    $0xc,%esp
  8015f6:	8b 7d 08             	mov    0x8(%ebp),%edi
  8015f9:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8015fc:	bb 00 00 00 00       	mov    $0x0,%ebx
  801601:	eb 02                	jmp    801605 <readn+0x1c>
  801603:	01 c3                	add    %eax,%ebx
  801605:	39 f3                	cmp    %esi,%ebx
  801607:	73 21                	jae    80162a <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801609:	83 ec 04             	sub    $0x4,%esp
  80160c:	89 f0                	mov    %esi,%eax
  80160e:	29 d8                	sub    %ebx,%eax
  801610:	50                   	push   %eax
  801611:	89 d8                	mov    %ebx,%eax
  801613:	03 45 0c             	add    0xc(%ebp),%eax
  801616:	50                   	push   %eax
  801617:	57                   	push   %edi
  801618:	e8 41 ff ff ff       	call   80155e <read>
		if (m < 0)
  80161d:	83 c4 10             	add    $0x10,%esp
  801620:	85 c0                	test   %eax,%eax
  801622:	78 04                	js     801628 <readn+0x3f>
			return m;
		if (m == 0)
  801624:	75 dd                	jne    801603 <readn+0x1a>
  801626:	eb 02                	jmp    80162a <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801628:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  80162a:	89 d8                	mov    %ebx,%eax
  80162c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80162f:	5b                   	pop    %ebx
  801630:	5e                   	pop    %esi
  801631:	5f                   	pop    %edi
  801632:	5d                   	pop    %ebp
  801633:	c3                   	ret    

00801634 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801634:	f3 0f 1e fb          	endbr32 
  801638:	55                   	push   %ebp
  801639:	89 e5                	mov    %esp,%ebp
  80163b:	53                   	push   %ebx
  80163c:	83 ec 1c             	sub    $0x1c,%esp
  80163f:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801642:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801645:	50                   	push   %eax
  801646:	53                   	push   %ebx
  801647:	e8 8f fc ff ff       	call   8012db <fd_lookup>
  80164c:	83 c4 10             	add    $0x10,%esp
  80164f:	85 c0                	test   %eax,%eax
  801651:	78 3a                	js     80168d <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801653:	83 ec 08             	sub    $0x8,%esp
  801656:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801659:	50                   	push   %eax
  80165a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80165d:	ff 30                	pushl  (%eax)
  80165f:	e8 cb fc ff ff       	call   80132f <dev_lookup>
  801664:	83 c4 10             	add    $0x10,%esp
  801667:	85 c0                	test   %eax,%eax
  801669:	78 22                	js     80168d <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80166b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80166e:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801672:	74 1e                	je     801692 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801674:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801677:	8b 52 0c             	mov    0xc(%edx),%edx
  80167a:	85 d2                	test   %edx,%edx
  80167c:	74 35                	je     8016b3 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80167e:	83 ec 04             	sub    $0x4,%esp
  801681:	ff 75 10             	pushl  0x10(%ebp)
  801684:	ff 75 0c             	pushl  0xc(%ebp)
  801687:	50                   	push   %eax
  801688:	ff d2                	call   *%edx
  80168a:	83 c4 10             	add    $0x10,%esp
}
  80168d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801690:	c9                   	leave  
  801691:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801692:	a1 04 40 80 00       	mov    0x804004,%eax
  801697:	8b 40 48             	mov    0x48(%eax),%eax
  80169a:	83 ec 04             	sub    $0x4,%esp
  80169d:	53                   	push   %ebx
  80169e:	50                   	push   %eax
  80169f:	68 79 28 80 00       	push   $0x802879
  8016a4:	e8 2a eb ff ff       	call   8001d3 <cprintf>
		return -E_INVAL;
  8016a9:	83 c4 10             	add    $0x10,%esp
  8016ac:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8016b1:	eb da                	jmp    80168d <write+0x59>
		return -E_NOT_SUPP;
  8016b3:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016b8:	eb d3                	jmp    80168d <write+0x59>

008016ba <seek>:

int
seek(int fdnum, off_t offset)
{
  8016ba:	f3 0f 1e fb          	endbr32 
  8016be:	55                   	push   %ebp
  8016bf:	89 e5                	mov    %esp,%ebp
  8016c1:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8016c4:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016c7:	50                   	push   %eax
  8016c8:	ff 75 08             	pushl  0x8(%ebp)
  8016cb:	e8 0b fc ff ff       	call   8012db <fd_lookup>
  8016d0:	83 c4 10             	add    $0x10,%esp
  8016d3:	85 c0                	test   %eax,%eax
  8016d5:	78 0e                	js     8016e5 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8016d7:	8b 55 0c             	mov    0xc(%ebp),%edx
  8016da:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8016dd:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8016e0:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8016e5:	c9                   	leave  
  8016e6:	c3                   	ret    

008016e7 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8016e7:	f3 0f 1e fb          	endbr32 
  8016eb:	55                   	push   %ebp
  8016ec:	89 e5                	mov    %esp,%ebp
  8016ee:	53                   	push   %ebx
  8016ef:	83 ec 1c             	sub    $0x1c,%esp
  8016f2:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8016f5:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8016f8:	50                   	push   %eax
  8016f9:	53                   	push   %ebx
  8016fa:	e8 dc fb ff ff       	call   8012db <fd_lookup>
  8016ff:	83 c4 10             	add    $0x10,%esp
  801702:	85 c0                	test   %eax,%eax
  801704:	78 37                	js     80173d <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801706:	83 ec 08             	sub    $0x8,%esp
  801709:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80170c:	50                   	push   %eax
  80170d:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801710:	ff 30                	pushl  (%eax)
  801712:	e8 18 fc ff ff       	call   80132f <dev_lookup>
  801717:	83 c4 10             	add    $0x10,%esp
  80171a:	85 c0                	test   %eax,%eax
  80171c:	78 1f                	js     80173d <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80171e:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801721:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801725:	74 1b                	je     801742 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  801727:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80172a:	8b 52 18             	mov    0x18(%edx),%edx
  80172d:	85 d2                	test   %edx,%edx
  80172f:	74 32                	je     801763 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801731:	83 ec 08             	sub    $0x8,%esp
  801734:	ff 75 0c             	pushl  0xc(%ebp)
  801737:	50                   	push   %eax
  801738:	ff d2                	call   *%edx
  80173a:	83 c4 10             	add    $0x10,%esp
}
  80173d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801740:	c9                   	leave  
  801741:	c3                   	ret    
			thisenv->env_id, fdnum);
  801742:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801747:	8b 40 48             	mov    0x48(%eax),%eax
  80174a:	83 ec 04             	sub    $0x4,%esp
  80174d:	53                   	push   %ebx
  80174e:	50                   	push   %eax
  80174f:	68 3c 28 80 00       	push   $0x80283c
  801754:	e8 7a ea ff ff       	call   8001d3 <cprintf>
		return -E_INVAL;
  801759:	83 c4 10             	add    $0x10,%esp
  80175c:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801761:	eb da                	jmp    80173d <ftruncate+0x56>
		return -E_NOT_SUPP;
  801763:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801768:	eb d3                	jmp    80173d <ftruncate+0x56>

0080176a <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  80176a:	f3 0f 1e fb          	endbr32 
  80176e:	55                   	push   %ebp
  80176f:	89 e5                	mov    %esp,%ebp
  801771:	53                   	push   %ebx
  801772:	83 ec 1c             	sub    $0x1c,%esp
  801775:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801778:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80177b:	50                   	push   %eax
  80177c:	ff 75 08             	pushl  0x8(%ebp)
  80177f:	e8 57 fb ff ff       	call   8012db <fd_lookup>
  801784:	83 c4 10             	add    $0x10,%esp
  801787:	85 c0                	test   %eax,%eax
  801789:	78 4b                	js     8017d6 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80178b:	83 ec 08             	sub    $0x8,%esp
  80178e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801791:	50                   	push   %eax
  801792:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801795:	ff 30                	pushl  (%eax)
  801797:	e8 93 fb ff ff       	call   80132f <dev_lookup>
  80179c:	83 c4 10             	add    $0x10,%esp
  80179f:	85 c0                	test   %eax,%eax
  8017a1:	78 33                	js     8017d6 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8017a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8017a6:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8017aa:	74 2f                	je     8017db <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8017ac:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8017af:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8017b6:	00 00 00 
	stat->st_isdir = 0;
  8017b9:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8017c0:	00 00 00 
	stat->st_dev = dev;
  8017c3:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  8017c9:	83 ec 08             	sub    $0x8,%esp
  8017cc:	53                   	push   %ebx
  8017cd:	ff 75 f0             	pushl  -0x10(%ebp)
  8017d0:	ff 50 14             	call   *0x14(%eax)
  8017d3:	83 c4 10             	add    $0x10,%esp
}
  8017d6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8017d9:	c9                   	leave  
  8017da:	c3                   	ret    
		return -E_NOT_SUPP;
  8017db:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8017e0:	eb f4                	jmp    8017d6 <fstat+0x6c>

008017e2 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  8017e2:	f3 0f 1e fb          	endbr32 
  8017e6:	55                   	push   %ebp
  8017e7:	89 e5                	mov    %esp,%ebp
  8017e9:	56                   	push   %esi
  8017ea:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8017eb:	83 ec 08             	sub    $0x8,%esp
  8017ee:	6a 00                	push   $0x0
  8017f0:	ff 75 08             	pushl  0x8(%ebp)
  8017f3:	e8 fb 01 00 00       	call   8019f3 <open>
  8017f8:	89 c3                	mov    %eax,%ebx
  8017fa:	83 c4 10             	add    $0x10,%esp
  8017fd:	85 c0                	test   %eax,%eax
  8017ff:	78 1b                	js     80181c <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801801:	83 ec 08             	sub    $0x8,%esp
  801804:	ff 75 0c             	pushl  0xc(%ebp)
  801807:	50                   	push   %eax
  801808:	e8 5d ff ff ff       	call   80176a <fstat>
  80180d:	89 c6                	mov    %eax,%esi
	close(fd);
  80180f:	89 1c 24             	mov    %ebx,(%esp)
  801812:	e8 fd fb ff ff       	call   801414 <close>
	return r;
  801817:	83 c4 10             	add    $0x10,%esp
  80181a:	89 f3                	mov    %esi,%ebx
}
  80181c:	89 d8                	mov    %ebx,%eax
  80181e:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801821:	5b                   	pop    %ebx
  801822:	5e                   	pop    %esi
  801823:	5d                   	pop    %ebp
  801824:	c3                   	ret    

00801825 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801825:	55                   	push   %ebp
  801826:	89 e5                	mov    %esp,%ebp
  801828:	56                   	push   %esi
  801829:	53                   	push   %ebx
  80182a:	89 c6                	mov    %eax,%esi
  80182c:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  80182e:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801835:	74 27                	je     80185e <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801837:	6a 07                	push   $0x7
  801839:	68 00 50 80 00       	push   $0x805000
  80183e:	56                   	push   %esi
  80183f:	ff 35 00 40 80 00    	pushl  0x804000
  801845:	e8 77 f9 ff ff       	call   8011c1 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  80184a:	83 c4 0c             	add    $0xc,%esp
  80184d:	6a 00                	push   $0x0
  80184f:	53                   	push   %ebx
  801850:	6a 00                	push   $0x0
  801852:	e8 e9 f8 ff ff       	call   801140 <ipc_recv>
}
  801857:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80185a:	5b                   	pop    %ebx
  80185b:	5e                   	pop    %esi
  80185c:	5d                   	pop    %ebp
  80185d:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  80185e:	83 ec 0c             	sub    $0xc,%esp
  801861:	6a 01                	push   $0x1
  801863:	e8 b1 f9 ff ff       	call   801219 <ipc_find_env>
  801868:	a3 00 40 80 00       	mov    %eax,0x804000
  80186d:	83 c4 10             	add    $0x10,%esp
  801870:	eb c5                	jmp    801837 <fsipc+0x12>

00801872 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801872:	f3 0f 1e fb          	endbr32 
  801876:	55                   	push   %ebp
  801877:	89 e5                	mov    %esp,%ebp
  801879:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  80187c:	8b 45 08             	mov    0x8(%ebp),%eax
  80187f:	8b 40 0c             	mov    0xc(%eax),%eax
  801882:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801887:	8b 45 0c             	mov    0xc(%ebp),%eax
  80188a:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80188f:	ba 00 00 00 00       	mov    $0x0,%edx
  801894:	b8 02 00 00 00       	mov    $0x2,%eax
  801899:	e8 87 ff ff ff       	call   801825 <fsipc>
}
  80189e:	c9                   	leave  
  80189f:	c3                   	ret    

008018a0 <devfile_flush>:
{
  8018a0:	f3 0f 1e fb          	endbr32 
  8018a4:	55                   	push   %ebp
  8018a5:	89 e5                	mov    %esp,%ebp
  8018a7:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8018aa:	8b 45 08             	mov    0x8(%ebp),%eax
  8018ad:	8b 40 0c             	mov    0xc(%eax),%eax
  8018b0:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8018b5:	ba 00 00 00 00       	mov    $0x0,%edx
  8018ba:	b8 06 00 00 00       	mov    $0x6,%eax
  8018bf:	e8 61 ff ff ff       	call   801825 <fsipc>
}
  8018c4:	c9                   	leave  
  8018c5:	c3                   	ret    

008018c6 <devfile_stat>:
{
  8018c6:	f3 0f 1e fb          	endbr32 
  8018ca:	55                   	push   %ebp
  8018cb:	89 e5                	mov    %esp,%ebp
  8018cd:	53                   	push   %ebx
  8018ce:	83 ec 04             	sub    $0x4,%esp
  8018d1:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8018d4:	8b 45 08             	mov    0x8(%ebp),%eax
  8018d7:	8b 40 0c             	mov    0xc(%eax),%eax
  8018da:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8018df:	ba 00 00 00 00       	mov    $0x0,%edx
  8018e4:	b8 05 00 00 00       	mov    $0x5,%eax
  8018e9:	e8 37 ff ff ff       	call   801825 <fsipc>
  8018ee:	85 c0                	test   %eax,%eax
  8018f0:	78 2c                	js     80191e <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8018f2:	83 ec 08             	sub    $0x8,%esp
  8018f5:	68 00 50 80 00       	push   $0x805000
  8018fa:	53                   	push   %ebx
  8018fb:	e8 ac ee ff ff       	call   8007ac <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801900:	a1 80 50 80 00       	mov    0x805080,%eax
  801905:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  80190b:	a1 84 50 80 00       	mov    0x805084,%eax
  801910:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801916:	83 c4 10             	add    $0x10,%esp
  801919:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80191e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801921:	c9                   	leave  
  801922:	c3                   	ret    

00801923 <devfile_write>:
{
  801923:	f3 0f 1e fb          	endbr32 
  801927:	55                   	push   %ebp
  801928:	89 e5                	mov    %esp,%ebp
  80192a:	83 ec 0c             	sub    $0xc,%esp
  80192d:	8b 45 10             	mov    0x10(%ebp),%eax
  801930:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801935:	ba f8 0f 00 00       	mov    $0xff8,%edx
  80193a:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  80193d:	8b 55 08             	mov    0x8(%ebp),%edx
  801940:	8b 52 0c             	mov    0xc(%edx),%edx
  801943:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801949:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  80194e:	50                   	push   %eax
  80194f:	ff 75 0c             	pushl  0xc(%ebp)
  801952:	68 08 50 80 00       	push   $0x805008
  801957:	e8 06 f0 ff ff       	call   800962 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  80195c:	ba 00 00 00 00       	mov    $0x0,%edx
  801961:	b8 04 00 00 00       	mov    $0x4,%eax
  801966:	e8 ba fe ff ff       	call   801825 <fsipc>
  80196b:	c9                   	leave  
  80196c:	c3                   	ret    

0080196d <devfile_read>:
{
  80196d:	f3 0f 1e fb          	endbr32 
  801971:	55                   	push   %ebp
  801972:	89 e5                	mov    %esp,%ebp
  801974:	56                   	push   %esi
  801975:	53                   	push   %ebx
  801976:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801979:	8b 45 08             	mov    0x8(%ebp),%eax
  80197c:	8b 40 0c             	mov    0xc(%eax),%eax
  80197f:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801984:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  80198a:	ba 00 00 00 00       	mov    $0x0,%edx
  80198f:	b8 03 00 00 00       	mov    $0x3,%eax
  801994:	e8 8c fe ff ff       	call   801825 <fsipc>
  801999:	89 c3                	mov    %eax,%ebx
  80199b:	85 c0                	test   %eax,%eax
  80199d:	78 1f                	js     8019be <devfile_read+0x51>
	assert(r <= n);
  80199f:	39 f0                	cmp    %esi,%eax
  8019a1:	77 24                	ja     8019c7 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8019a3:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8019a8:	7f 33                	jg     8019dd <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8019aa:	83 ec 04             	sub    $0x4,%esp
  8019ad:	50                   	push   %eax
  8019ae:	68 00 50 80 00       	push   $0x805000
  8019b3:	ff 75 0c             	pushl  0xc(%ebp)
  8019b6:	e8 a7 ef ff ff       	call   800962 <memmove>
	return r;
  8019bb:	83 c4 10             	add    $0x10,%esp
}
  8019be:	89 d8                	mov    %ebx,%eax
  8019c0:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8019c3:	5b                   	pop    %ebx
  8019c4:	5e                   	pop    %esi
  8019c5:	5d                   	pop    %ebp
  8019c6:	c3                   	ret    
	assert(r <= n);
  8019c7:	68 a8 28 80 00       	push   $0x8028a8
  8019cc:	68 af 28 80 00       	push   $0x8028af
  8019d1:	6a 7c                	push   $0x7c
  8019d3:	68 c4 28 80 00       	push   $0x8028c4
  8019d8:	e8 be 05 00 00       	call   801f9b <_panic>
	assert(r <= PGSIZE);
  8019dd:	68 cf 28 80 00       	push   $0x8028cf
  8019e2:	68 af 28 80 00       	push   $0x8028af
  8019e7:	6a 7d                	push   $0x7d
  8019e9:	68 c4 28 80 00       	push   $0x8028c4
  8019ee:	e8 a8 05 00 00       	call   801f9b <_panic>

008019f3 <open>:
{
  8019f3:	f3 0f 1e fb          	endbr32 
  8019f7:	55                   	push   %ebp
  8019f8:	89 e5                	mov    %esp,%ebp
  8019fa:	56                   	push   %esi
  8019fb:	53                   	push   %ebx
  8019fc:	83 ec 1c             	sub    $0x1c,%esp
  8019ff:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801a02:	56                   	push   %esi
  801a03:	e8 61 ed ff ff       	call   800769 <strlen>
  801a08:	83 c4 10             	add    $0x10,%esp
  801a0b:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801a10:	7f 6c                	jg     801a7e <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801a12:	83 ec 0c             	sub    $0xc,%esp
  801a15:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a18:	50                   	push   %eax
  801a19:	e8 67 f8 ff ff       	call   801285 <fd_alloc>
  801a1e:	89 c3                	mov    %eax,%ebx
  801a20:	83 c4 10             	add    $0x10,%esp
  801a23:	85 c0                	test   %eax,%eax
  801a25:	78 3c                	js     801a63 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801a27:	83 ec 08             	sub    $0x8,%esp
  801a2a:	56                   	push   %esi
  801a2b:	68 00 50 80 00       	push   $0x805000
  801a30:	e8 77 ed ff ff       	call   8007ac <strcpy>
	fsipcbuf.open.req_omode = mode;
  801a35:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a38:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801a3d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801a40:	b8 01 00 00 00       	mov    $0x1,%eax
  801a45:	e8 db fd ff ff       	call   801825 <fsipc>
  801a4a:	89 c3                	mov    %eax,%ebx
  801a4c:	83 c4 10             	add    $0x10,%esp
  801a4f:	85 c0                	test   %eax,%eax
  801a51:	78 19                	js     801a6c <open+0x79>
	return fd2num(fd);
  801a53:	83 ec 0c             	sub    $0xc,%esp
  801a56:	ff 75 f4             	pushl  -0xc(%ebp)
  801a59:	e8 f8 f7 ff ff       	call   801256 <fd2num>
  801a5e:	89 c3                	mov    %eax,%ebx
  801a60:	83 c4 10             	add    $0x10,%esp
}
  801a63:	89 d8                	mov    %ebx,%eax
  801a65:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a68:	5b                   	pop    %ebx
  801a69:	5e                   	pop    %esi
  801a6a:	5d                   	pop    %ebp
  801a6b:	c3                   	ret    
		fd_close(fd, 0);
  801a6c:	83 ec 08             	sub    $0x8,%esp
  801a6f:	6a 00                	push   $0x0
  801a71:	ff 75 f4             	pushl  -0xc(%ebp)
  801a74:	e8 10 f9 ff ff       	call   801389 <fd_close>
		return r;
  801a79:	83 c4 10             	add    $0x10,%esp
  801a7c:	eb e5                	jmp    801a63 <open+0x70>
		return -E_BAD_PATH;
  801a7e:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801a83:	eb de                	jmp    801a63 <open+0x70>

00801a85 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801a85:	f3 0f 1e fb          	endbr32 
  801a89:	55                   	push   %ebp
  801a8a:	89 e5                	mov    %esp,%ebp
  801a8c:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801a8f:	ba 00 00 00 00       	mov    $0x0,%edx
  801a94:	b8 08 00 00 00       	mov    $0x8,%eax
  801a99:	e8 87 fd ff ff       	call   801825 <fsipc>
}
  801a9e:	c9                   	leave  
  801a9f:	c3                   	ret    

00801aa0 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801aa0:	f3 0f 1e fb          	endbr32 
  801aa4:	55                   	push   %ebp
  801aa5:	89 e5                	mov    %esp,%ebp
  801aa7:	56                   	push   %esi
  801aa8:	53                   	push   %ebx
  801aa9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801aac:	83 ec 0c             	sub    $0xc,%esp
  801aaf:	ff 75 08             	pushl  0x8(%ebp)
  801ab2:	e8 b3 f7 ff ff       	call   80126a <fd2data>
  801ab7:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801ab9:	83 c4 08             	add    $0x8,%esp
  801abc:	68 db 28 80 00       	push   $0x8028db
  801ac1:	53                   	push   %ebx
  801ac2:	e8 e5 ec ff ff       	call   8007ac <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801ac7:	8b 46 04             	mov    0x4(%esi),%eax
  801aca:	2b 06                	sub    (%esi),%eax
  801acc:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801ad2:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801ad9:	00 00 00 
	stat->st_dev = &devpipe;
  801adc:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801ae3:	30 80 00 
	return 0;
}
  801ae6:	b8 00 00 00 00       	mov    $0x0,%eax
  801aeb:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aee:	5b                   	pop    %ebx
  801aef:	5e                   	pop    %esi
  801af0:	5d                   	pop    %ebp
  801af1:	c3                   	ret    

00801af2 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801af2:	f3 0f 1e fb          	endbr32 
  801af6:	55                   	push   %ebp
  801af7:	89 e5                	mov    %esp,%ebp
  801af9:	53                   	push   %ebx
  801afa:	83 ec 0c             	sub    $0xc,%esp
  801afd:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801b00:	53                   	push   %ebx
  801b01:	6a 00                	push   $0x0
  801b03:	e8 73 f1 ff ff       	call   800c7b <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801b08:	89 1c 24             	mov    %ebx,(%esp)
  801b0b:	e8 5a f7 ff ff       	call   80126a <fd2data>
  801b10:	83 c4 08             	add    $0x8,%esp
  801b13:	50                   	push   %eax
  801b14:	6a 00                	push   $0x0
  801b16:	e8 60 f1 ff ff       	call   800c7b <sys_page_unmap>
}
  801b1b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801b1e:	c9                   	leave  
  801b1f:	c3                   	ret    

00801b20 <_pipeisclosed>:
{
  801b20:	55                   	push   %ebp
  801b21:	89 e5                	mov    %esp,%ebp
  801b23:	57                   	push   %edi
  801b24:	56                   	push   %esi
  801b25:	53                   	push   %ebx
  801b26:	83 ec 1c             	sub    $0x1c,%esp
  801b29:	89 c7                	mov    %eax,%edi
  801b2b:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801b2d:	a1 04 40 80 00       	mov    0x804004,%eax
  801b32:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801b35:	83 ec 0c             	sub    $0xc,%esp
  801b38:	57                   	push   %edi
  801b39:	e8 48 05 00 00       	call   802086 <pageref>
  801b3e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801b41:	89 34 24             	mov    %esi,(%esp)
  801b44:	e8 3d 05 00 00       	call   802086 <pageref>
		nn = thisenv->env_runs;
  801b49:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801b4f:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801b52:	83 c4 10             	add    $0x10,%esp
  801b55:	39 cb                	cmp    %ecx,%ebx
  801b57:	74 1b                	je     801b74 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801b59:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801b5c:	75 cf                	jne    801b2d <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801b5e:	8b 42 58             	mov    0x58(%edx),%eax
  801b61:	6a 01                	push   $0x1
  801b63:	50                   	push   %eax
  801b64:	53                   	push   %ebx
  801b65:	68 e2 28 80 00       	push   $0x8028e2
  801b6a:	e8 64 e6 ff ff       	call   8001d3 <cprintf>
  801b6f:	83 c4 10             	add    $0x10,%esp
  801b72:	eb b9                	jmp    801b2d <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801b74:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801b77:	0f 94 c0             	sete   %al
  801b7a:	0f b6 c0             	movzbl %al,%eax
}
  801b7d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b80:	5b                   	pop    %ebx
  801b81:	5e                   	pop    %esi
  801b82:	5f                   	pop    %edi
  801b83:	5d                   	pop    %ebp
  801b84:	c3                   	ret    

00801b85 <devpipe_write>:
{
  801b85:	f3 0f 1e fb          	endbr32 
  801b89:	55                   	push   %ebp
  801b8a:	89 e5                	mov    %esp,%ebp
  801b8c:	57                   	push   %edi
  801b8d:	56                   	push   %esi
  801b8e:	53                   	push   %ebx
  801b8f:	83 ec 28             	sub    $0x28,%esp
  801b92:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801b95:	56                   	push   %esi
  801b96:	e8 cf f6 ff ff       	call   80126a <fd2data>
  801b9b:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801b9d:	83 c4 10             	add    $0x10,%esp
  801ba0:	bf 00 00 00 00       	mov    $0x0,%edi
  801ba5:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801ba8:	74 4f                	je     801bf9 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801baa:	8b 43 04             	mov    0x4(%ebx),%eax
  801bad:	8b 0b                	mov    (%ebx),%ecx
  801baf:	8d 51 20             	lea    0x20(%ecx),%edx
  801bb2:	39 d0                	cmp    %edx,%eax
  801bb4:	72 14                	jb     801bca <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801bb6:	89 da                	mov    %ebx,%edx
  801bb8:	89 f0                	mov    %esi,%eax
  801bba:	e8 61 ff ff ff       	call   801b20 <_pipeisclosed>
  801bbf:	85 c0                	test   %eax,%eax
  801bc1:	75 3b                	jne    801bfe <devpipe_write+0x79>
			sys_yield();
  801bc3:	e8 03 f0 ff ff       	call   800bcb <sys_yield>
  801bc8:	eb e0                	jmp    801baa <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801bca:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801bcd:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801bd1:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801bd4:	89 c2                	mov    %eax,%edx
  801bd6:	c1 fa 1f             	sar    $0x1f,%edx
  801bd9:	89 d1                	mov    %edx,%ecx
  801bdb:	c1 e9 1b             	shr    $0x1b,%ecx
  801bde:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801be1:	83 e2 1f             	and    $0x1f,%edx
  801be4:	29 ca                	sub    %ecx,%edx
  801be6:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801bea:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801bee:	83 c0 01             	add    $0x1,%eax
  801bf1:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801bf4:	83 c7 01             	add    $0x1,%edi
  801bf7:	eb ac                	jmp    801ba5 <devpipe_write+0x20>
	return i;
  801bf9:	8b 45 10             	mov    0x10(%ebp),%eax
  801bfc:	eb 05                	jmp    801c03 <devpipe_write+0x7e>
				return 0;
  801bfe:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801c03:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c06:	5b                   	pop    %ebx
  801c07:	5e                   	pop    %esi
  801c08:	5f                   	pop    %edi
  801c09:	5d                   	pop    %ebp
  801c0a:	c3                   	ret    

00801c0b <devpipe_read>:
{
  801c0b:	f3 0f 1e fb          	endbr32 
  801c0f:	55                   	push   %ebp
  801c10:	89 e5                	mov    %esp,%ebp
  801c12:	57                   	push   %edi
  801c13:	56                   	push   %esi
  801c14:	53                   	push   %ebx
  801c15:	83 ec 18             	sub    $0x18,%esp
  801c18:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801c1b:	57                   	push   %edi
  801c1c:	e8 49 f6 ff ff       	call   80126a <fd2data>
  801c21:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801c23:	83 c4 10             	add    $0x10,%esp
  801c26:	be 00 00 00 00       	mov    $0x0,%esi
  801c2b:	3b 75 10             	cmp    0x10(%ebp),%esi
  801c2e:	75 14                	jne    801c44 <devpipe_read+0x39>
	return i;
  801c30:	8b 45 10             	mov    0x10(%ebp),%eax
  801c33:	eb 02                	jmp    801c37 <devpipe_read+0x2c>
				return i;
  801c35:	89 f0                	mov    %esi,%eax
}
  801c37:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c3a:	5b                   	pop    %ebx
  801c3b:	5e                   	pop    %esi
  801c3c:	5f                   	pop    %edi
  801c3d:	5d                   	pop    %ebp
  801c3e:	c3                   	ret    
			sys_yield();
  801c3f:	e8 87 ef ff ff       	call   800bcb <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801c44:	8b 03                	mov    (%ebx),%eax
  801c46:	3b 43 04             	cmp    0x4(%ebx),%eax
  801c49:	75 18                	jne    801c63 <devpipe_read+0x58>
			if (i > 0)
  801c4b:	85 f6                	test   %esi,%esi
  801c4d:	75 e6                	jne    801c35 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801c4f:	89 da                	mov    %ebx,%edx
  801c51:	89 f8                	mov    %edi,%eax
  801c53:	e8 c8 fe ff ff       	call   801b20 <_pipeisclosed>
  801c58:	85 c0                	test   %eax,%eax
  801c5a:	74 e3                	je     801c3f <devpipe_read+0x34>
				return 0;
  801c5c:	b8 00 00 00 00       	mov    $0x0,%eax
  801c61:	eb d4                	jmp    801c37 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801c63:	99                   	cltd   
  801c64:	c1 ea 1b             	shr    $0x1b,%edx
  801c67:	01 d0                	add    %edx,%eax
  801c69:	83 e0 1f             	and    $0x1f,%eax
  801c6c:	29 d0                	sub    %edx,%eax
  801c6e:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801c73:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c76:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801c79:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801c7c:	83 c6 01             	add    $0x1,%esi
  801c7f:	eb aa                	jmp    801c2b <devpipe_read+0x20>

00801c81 <pipe>:
{
  801c81:	f3 0f 1e fb          	endbr32 
  801c85:	55                   	push   %ebp
  801c86:	89 e5                	mov    %esp,%ebp
  801c88:	56                   	push   %esi
  801c89:	53                   	push   %ebx
  801c8a:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801c8d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801c90:	50                   	push   %eax
  801c91:	e8 ef f5 ff ff       	call   801285 <fd_alloc>
  801c96:	89 c3                	mov    %eax,%ebx
  801c98:	83 c4 10             	add    $0x10,%esp
  801c9b:	85 c0                	test   %eax,%eax
  801c9d:	0f 88 23 01 00 00    	js     801dc6 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ca3:	83 ec 04             	sub    $0x4,%esp
  801ca6:	68 07 04 00 00       	push   $0x407
  801cab:	ff 75 f4             	pushl  -0xc(%ebp)
  801cae:	6a 00                	push   $0x0
  801cb0:	e8 39 ef ff ff       	call   800bee <sys_page_alloc>
  801cb5:	89 c3                	mov    %eax,%ebx
  801cb7:	83 c4 10             	add    $0x10,%esp
  801cba:	85 c0                	test   %eax,%eax
  801cbc:	0f 88 04 01 00 00    	js     801dc6 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801cc2:	83 ec 0c             	sub    $0xc,%esp
  801cc5:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801cc8:	50                   	push   %eax
  801cc9:	e8 b7 f5 ff ff       	call   801285 <fd_alloc>
  801cce:	89 c3                	mov    %eax,%ebx
  801cd0:	83 c4 10             	add    $0x10,%esp
  801cd3:	85 c0                	test   %eax,%eax
  801cd5:	0f 88 db 00 00 00    	js     801db6 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801cdb:	83 ec 04             	sub    $0x4,%esp
  801cde:	68 07 04 00 00       	push   $0x407
  801ce3:	ff 75 f0             	pushl  -0x10(%ebp)
  801ce6:	6a 00                	push   $0x0
  801ce8:	e8 01 ef ff ff       	call   800bee <sys_page_alloc>
  801ced:	89 c3                	mov    %eax,%ebx
  801cef:	83 c4 10             	add    $0x10,%esp
  801cf2:	85 c0                	test   %eax,%eax
  801cf4:	0f 88 bc 00 00 00    	js     801db6 <pipe+0x135>
	va = fd2data(fd0);
  801cfa:	83 ec 0c             	sub    $0xc,%esp
  801cfd:	ff 75 f4             	pushl  -0xc(%ebp)
  801d00:	e8 65 f5 ff ff       	call   80126a <fd2data>
  801d05:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d07:	83 c4 0c             	add    $0xc,%esp
  801d0a:	68 07 04 00 00       	push   $0x407
  801d0f:	50                   	push   %eax
  801d10:	6a 00                	push   $0x0
  801d12:	e8 d7 ee ff ff       	call   800bee <sys_page_alloc>
  801d17:	89 c3                	mov    %eax,%ebx
  801d19:	83 c4 10             	add    $0x10,%esp
  801d1c:	85 c0                	test   %eax,%eax
  801d1e:	0f 88 82 00 00 00    	js     801da6 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d24:	83 ec 0c             	sub    $0xc,%esp
  801d27:	ff 75 f0             	pushl  -0x10(%ebp)
  801d2a:	e8 3b f5 ff ff       	call   80126a <fd2data>
  801d2f:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801d36:	50                   	push   %eax
  801d37:	6a 00                	push   $0x0
  801d39:	56                   	push   %esi
  801d3a:	6a 00                	push   $0x0
  801d3c:	e8 f4 ee ff ff       	call   800c35 <sys_page_map>
  801d41:	89 c3                	mov    %eax,%ebx
  801d43:	83 c4 20             	add    $0x20,%esp
  801d46:	85 c0                	test   %eax,%eax
  801d48:	78 4e                	js     801d98 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801d4a:	a1 20 30 80 00       	mov    0x803020,%eax
  801d4f:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d52:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801d54:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d57:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801d5e:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801d61:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801d63:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801d66:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801d6d:	83 ec 0c             	sub    $0xc,%esp
  801d70:	ff 75 f4             	pushl  -0xc(%ebp)
  801d73:	e8 de f4 ff ff       	call   801256 <fd2num>
  801d78:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801d7b:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801d7d:	83 c4 04             	add    $0x4,%esp
  801d80:	ff 75 f0             	pushl  -0x10(%ebp)
  801d83:	e8 ce f4 ff ff       	call   801256 <fd2num>
  801d88:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801d8b:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801d8e:	83 c4 10             	add    $0x10,%esp
  801d91:	bb 00 00 00 00       	mov    $0x0,%ebx
  801d96:	eb 2e                	jmp    801dc6 <pipe+0x145>
	sys_page_unmap(0, va);
  801d98:	83 ec 08             	sub    $0x8,%esp
  801d9b:	56                   	push   %esi
  801d9c:	6a 00                	push   $0x0
  801d9e:	e8 d8 ee ff ff       	call   800c7b <sys_page_unmap>
  801da3:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801da6:	83 ec 08             	sub    $0x8,%esp
  801da9:	ff 75 f0             	pushl  -0x10(%ebp)
  801dac:	6a 00                	push   $0x0
  801dae:	e8 c8 ee ff ff       	call   800c7b <sys_page_unmap>
  801db3:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801db6:	83 ec 08             	sub    $0x8,%esp
  801db9:	ff 75 f4             	pushl  -0xc(%ebp)
  801dbc:	6a 00                	push   $0x0
  801dbe:	e8 b8 ee ff ff       	call   800c7b <sys_page_unmap>
  801dc3:	83 c4 10             	add    $0x10,%esp
}
  801dc6:	89 d8                	mov    %ebx,%eax
  801dc8:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801dcb:	5b                   	pop    %ebx
  801dcc:	5e                   	pop    %esi
  801dcd:	5d                   	pop    %ebp
  801dce:	c3                   	ret    

00801dcf <pipeisclosed>:
{
  801dcf:	f3 0f 1e fb          	endbr32 
  801dd3:	55                   	push   %ebp
  801dd4:	89 e5                	mov    %esp,%ebp
  801dd6:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801dd9:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801ddc:	50                   	push   %eax
  801ddd:	ff 75 08             	pushl  0x8(%ebp)
  801de0:	e8 f6 f4 ff ff       	call   8012db <fd_lookup>
  801de5:	83 c4 10             	add    $0x10,%esp
  801de8:	85 c0                	test   %eax,%eax
  801dea:	78 18                	js     801e04 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801dec:	83 ec 0c             	sub    $0xc,%esp
  801def:	ff 75 f4             	pushl  -0xc(%ebp)
  801df2:	e8 73 f4 ff ff       	call   80126a <fd2data>
  801df7:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801df9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801dfc:	e8 1f fd ff ff       	call   801b20 <_pipeisclosed>
  801e01:	83 c4 10             	add    $0x10,%esp
}
  801e04:	c9                   	leave  
  801e05:	c3                   	ret    

00801e06 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801e06:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801e0a:	b8 00 00 00 00       	mov    $0x0,%eax
  801e0f:	c3                   	ret    

00801e10 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801e10:	f3 0f 1e fb          	endbr32 
  801e14:	55                   	push   %ebp
  801e15:	89 e5                	mov    %esp,%ebp
  801e17:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801e1a:	68 fa 28 80 00       	push   $0x8028fa
  801e1f:	ff 75 0c             	pushl  0xc(%ebp)
  801e22:	e8 85 e9 ff ff       	call   8007ac <strcpy>
	return 0;
}
  801e27:	b8 00 00 00 00       	mov    $0x0,%eax
  801e2c:	c9                   	leave  
  801e2d:	c3                   	ret    

00801e2e <devcons_write>:
{
  801e2e:	f3 0f 1e fb          	endbr32 
  801e32:	55                   	push   %ebp
  801e33:	89 e5                	mov    %esp,%ebp
  801e35:	57                   	push   %edi
  801e36:	56                   	push   %esi
  801e37:	53                   	push   %ebx
  801e38:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801e3e:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801e43:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801e49:	3b 75 10             	cmp    0x10(%ebp),%esi
  801e4c:	73 31                	jae    801e7f <devcons_write+0x51>
		m = n - tot;
  801e4e:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801e51:	29 f3                	sub    %esi,%ebx
  801e53:	83 fb 7f             	cmp    $0x7f,%ebx
  801e56:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801e5b:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801e5e:	83 ec 04             	sub    $0x4,%esp
  801e61:	53                   	push   %ebx
  801e62:	89 f0                	mov    %esi,%eax
  801e64:	03 45 0c             	add    0xc(%ebp),%eax
  801e67:	50                   	push   %eax
  801e68:	57                   	push   %edi
  801e69:	e8 f4 ea ff ff       	call   800962 <memmove>
		sys_cputs(buf, m);
  801e6e:	83 c4 08             	add    $0x8,%esp
  801e71:	53                   	push   %ebx
  801e72:	57                   	push   %edi
  801e73:	e8 a6 ec ff ff       	call   800b1e <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801e78:	01 de                	add    %ebx,%esi
  801e7a:	83 c4 10             	add    $0x10,%esp
  801e7d:	eb ca                	jmp    801e49 <devcons_write+0x1b>
}
  801e7f:	89 f0                	mov    %esi,%eax
  801e81:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801e84:	5b                   	pop    %ebx
  801e85:	5e                   	pop    %esi
  801e86:	5f                   	pop    %edi
  801e87:	5d                   	pop    %ebp
  801e88:	c3                   	ret    

00801e89 <devcons_read>:
{
  801e89:	f3 0f 1e fb          	endbr32 
  801e8d:	55                   	push   %ebp
  801e8e:	89 e5                	mov    %esp,%ebp
  801e90:	83 ec 08             	sub    $0x8,%esp
  801e93:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801e98:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801e9c:	74 21                	je     801ebf <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801e9e:	e8 9d ec ff ff       	call   800b40 <sys_cgetc>
  801ea3:	85 c0                	test   %eax,%eax
  801ea5:	75 07                	jne    801eae <devcons_read+0x25>
		sys_yield();
  801ea7:	e8 1f ed ff ff       	call   800bcb <sys_yield>
  801eac:	eb f0                	jmp    801e9e <devcons_read+0x15>
	if (c < 0)
  801eae:	78 0f                	js     801ebf <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801eb0:	83 f8 04             	cmp    $0x4,%eax
  801eb3:	74 0c                	je     801ec1 <devcons_read+0x38>
	*(char*)vbuf = c;
  801eb5:	8b 55 0c             	mov    0xc(%ebp),%edx
  801eb8:	88 02                	mov    %al,(%edx)
	return 1;
  801eba:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801ebf:	c9                   	leave  
  801ec0:	c3                   	ret    
		return 0;
  801ec1:	b8 00 00 00 00       	mov    $0x0,%eax
  801ec6:	eb f7                	jmp    801ebf <devcons_read+0x36>

00801ec8 <cputchar>:
{
  801ec8:	f3 0f 1e fb          	endbr32 
  801ecc:	55                   	push   %ebp
  801ecd:	89 e5                	mov    %esp,%ebp
  801ecf:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801ed2:	8b 45 08             	mov    0x8(%ebp),%eax
  801ed5:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801ed8:	6a 01                	push   $0x1
  801eda:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801edd:	50                   	push   %eax
  801ede:	e8 3b ec ff ff       	call   800b1e <sys_cputs>
}
  801ee3:	83 c4 10             	add    $0x10,%esp
  801ee6:	c9                   	leave  
  801ee7:	c3                   	ret    

00801ee8 <getchar>:
{
  801ee8:	f3 0f 1e fb          	endbr32 
  801eec:	55                   	push   %ebp
  801eed:	89 e5                	mov    %esp,%ebp
  801eef:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801ef2:	6a 01                	push   $0x1
  801ef4:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801ef7:	50                   	push   %eax
  801ef8:	6a 00                	push   $0x0
  801efa:	e8 5f f6 ff ff       	call   80155e <read>
	if (r < 0)
  801eff:	83 c4 10             	add    $0x10,%esp
  801f02:	85 c0                	test   %eax,%eax
  801f04:	78 06                	js     801f0c <getchar+0x24>
	if (r < 1)
  801f06:	74 06                	je     801f0e <getchar+0x26>
	return c;
  801f08:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801f0c:	c9                   	leave  
  801f0d:	c3                   	ret    
		return -E_EOF;
  801f0e:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801f13:	eb f7                	jmp    801f0c <getchar+0x24>

00801f15 <iscons>:
{
  801f15:	f3 0f 1e fb          	endbr32 
  801f19:	55                   	push   %ebp
  801f1a:	89 e5                	mov    %esp,%ebp
  801f1c:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801f1f:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f22:	50                   	push   %eax
  801f23:	ff 75 08             	pushl  0x8(%ebp)
  801f26:	e8 b0 f3 ff ff       	call   8012db <fd_lookup>
  801f2b:	83 c4 10             	add    $0x10,%esp
  801f2e:	85 c0                	test   %eax,%eax
  801f30:	78 11                	js     801f43 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801f32:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801f35:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801f3b:	39 10                	cmp    %edx,(%eax)
  801f3d:	0f 94 c0             	sete   %al
  801f40:	0f b6 c0             	movzbl %al,%eax
}
  801f43:	c9                   	leave  
  801f44:	c3                   	ret    

00801f45 <opencons>:
{
  801f45:	f3 0f 1e fb          	endbr32 
  801f49:	55                   	push   %ebp
  801f4a:	89 e5                	mov    %esp,%ebp
  801f4c:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801f4f:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f52:	50                   	push   %eax
  801f53:	e8 2d f3 ff ff       	call   801285 <fd_alloc>
  801f58:	83 c4 10             	add    $0x10,%esp
  801f5b:	85 c0                	test   %eax,%eax
  801f5d:	78 3a                	js     801f99 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801f5f:	83 ec 04             	sub    $0x4,%esp
  801f62:	68 07 04 00 00       	push   $0x407
  801f67:	ff 75 f4             	pushl  -0xc(%ebp)
  801f6a:	6a 00                	push   $0x0
  801f6c:	e8 7d ec ff ff       	call   800bee <sys_page_alloc>
  801f71:	83 c4 10             	add    $0x10,%esp
  801f74:	85 c0                	test   %eax,%eax
  801f76:	78 21                	js     801f99 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801f78:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801f7b:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801f81:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801f83:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801f86:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801f8d:	83 ec 0c             	sub    $0xc,%esp
  801f90:	50                   	push   %eax
  801f91:	e8 c0 f2 ff ff       	call   801256 <fd2num>
  801f96:	83 c4 10             	add    $0x10,%esp
}
  801f99:	c9                   	leave  
  801f9a:	c3                   	ret    

00801f9b <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801f9b:	f3 0f 1e fb          	endbr32 
  801f9f:	55                   	push   %ebp
  801fa0:	89 e5                	mov    %esp,%ebp
  801fa2:	56                   	push   %esi
  801fa3:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801fa4:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801fa7:	8b 35 00 30 80 00    	mov    0x803000,%esi
  801fad:	e8 f6 eb ff ff       	call   800ba8 <sys_getenvid>
  801fb2:	83 ec 0c             	sub    $0xc,%esp
  801fb5:	ff 75 0c             	pushl  0xc(%ebp)
  801fb8:	ff 75 08             	pushl  0x8(%ebp)
  801fbb:	56                   	push   %esi
  801fbc:	50                   	push   %eax
  801fbd:	68 08 29 80 00       	push   $0x802908
  801fc2:	e8 0c e2 ff ff       	call   8001d3 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  801fc7:	83 c4 18             	add    $0x18,%esp
  801fca:	53                   	push   %ebx
  801fcb:	ff 75 10             	pushl  0x10(%ebp)
  801fce:	e8 ab e1 ff ff       	call   80017e <vcprintf>
	cprintf("\n");
  801fd3:	c7 04 24 f3 28 80 00 	movl   $0x8028f3,(%esp)
  801fda:	e8 f4 e1 ff ff       	call   8001d3 <cprintf>
  801fdf:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  801fe2:	cc                   	int3   
  801fe3:	eb fd                	jmp    801fe2 <_panic+0x47>

00801fe5 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  801fe5:	f3 0f 1e fb          	endbr32 
  801fe9:	55                   	push   %ebp
  801fea:	89 e5                	mov    %esp,%ebp
  801fec:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  801fef:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  801ff6:	74 27                	je     80201f <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  801ff8:	8b 45 08             	mov    0x8(%ebp),%eax
  801ffb:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  802000:	a1 04 40 80 00       	mov    0x804004,%eax
  802005:	8b 40 48             	mov    0x48(%eax),%eax
  802008:	83 ec 08             	sub    $0x8,%esp
  80200b:	68 5f 20 80 00       	push   $0x80205f
  802010:	50                   	push   %eax
  802011:	e8 37 ed ff ff       	call   800d4d <sys_env_set_pgfault_upcall>
  802016:	83 c4 10             	add    $0x10,%esp
  802019:	85 c0                	test   %eax,%eax
  80201b:	78 2e                	js     80204b <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  80201d:	c9                   	leave  
  80201e:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  80201f:	83 ec 04             	sub    $0x4,%esp
  802022:	6a 07                	push   $0x7
  802024:	68 00 f0 bf ee       	push   $0xeebff000
  802029:	6a 00                	push   $0x0
  80202b:	e8 be eb ff ff       	call   800bee <sys_page_alloc>
  802030:	83 c4 10             	add    $0x10,%esp
  802033:	85 c0                	test   %eax,%eax
  802035:	79 c1                	jns    801ff8 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  802037:	83 ec 04             	sub    $0x4,%esp
  80203a:	68 2c 29 80 00       	push   $0x80292c
  80203f:	6a 21                	push   $0x21
  802041:	68 8e 29 80 00       	push   $0x80298e
  802046:	e8 50 ff ff ff       	call   801f9b <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  80204b:	83 ec 04             	sub    $0x4,%esp
  80204e:	68 58 29 80 00       	push   $0x802958
  802053:	6a 27                	push   $0x27
  802055:	68 8e 29 80 00       	push   $0x80298e
  80205a:	e8 3c ff ff ff       	call   801f9b <_panic>

0080205f <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  80205f:	54                   	push   %esp
	movl _pgfault_handler, %eax
  802060:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  802065:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  802067:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  80206a:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  80206e:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  802071:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  802075:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  802079:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  80207c:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  80207f:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  802080:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  802083:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  802084:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  802085:	c3                   	ret    

00802086 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  802086:	f3 0f 1e fb          	endbr32 
  80208a:	55                   	push   %ebp
  80208b:	89 e5                	mov    %esp,%ebp
  80208d:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  802090:	89 c2                	mov    %eax,%edx
  802092:	c1 ea 16             	shr    $0x16,%edx
  802095:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  80209c:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8020a1:	f6 c1 01             	test   $0x1,%cl
  8020a4:	74 1c                	je     8020c2 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8020a6:	c1 e8 0c             	shr    $0xc,%eax
  8020a9:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8020b0:	a8 01                	test   $0x1,%al
  8020b2:	74 0e                	je     8020c2 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8020b4:	c1 e8 0c             	shr    $0xc,%eax
  8020b7:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8020be:	ef 
  8020bf:	0f b7 d2             	movzwl %dx,%edx
}
  8020c2:	89 d0                	mov    %edx,%eax
  8020c4:	5d                   	pop    %ebp
  8020c5:	c3                   	ret    
  8020c6:	66 90                	xchg   %ax,%ax
  8020c8:	66 90                	xchg   %ax,%ax
  8020ca:	66 90                	xchg   %ax,%ax
  8020cc:	66 90                	xchg   %ax,%ax
  8020ce:	66 90                	xchg   %ax,%ax

008020d0 <__udivdi3>:
  8020d0:	f3 0f 1e fb          	endbr32 
  8020d4:	55                   	push   %ebp
  8020d5:	57                   	push   %edi
  8020d6:	56                   	push   %esi
  8020d7:	53                   	push   %ebx
  8020d8:	83 ec 1c             	sub    $0x1c,%esp
  8020db:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8020df:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8020e3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8020e7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8020eb:	85 d2                	test   %edx,%edx
  8020ed:	75 19                	jne    802108 <__udivdi3+0x38>
  8020ef:	39 f3                	cmp    %esi,%ebx
  8020f1:	76 4d                	jbe    802140 <__udivdi3+0x70>
  8020f3:	31 ff                	xor    %edi,%edi
  8020f5:	89 e8                	mov    %ebp,%eax
  8020f7:	89 f2                	mov    %esi,%edx
  8020f9:	f7 f3                	div    %ebx
  8020fb:	89 fa                	mov    %edi,%edx
  8020fd:	83 c4 1c             	add    $0x1c,%esp
  802100:	5b                   	pop    %ebx
  802101:	5e                   	pop    %esi
  802102:	5f                   	pop    %edi
  802103:	5d                   	pop    %ebp
  802104:	c3                   	ret    
  802105:	8d 76 00             	lea    0x0(%esi),%esi
  802108:	39 f2                	cmp    %esi,%edx
  80210a:	76 14                	jbe    802120 <__udivdi3+0x50>
  80210c:	31 ff                	xor    %edi,%edi
  80210e:	31 c0                	xor    %eax,%eax
  802110:	89 fa                	mov    %edi,%edx
  802112:	83 c4 1c             	add    $0x1c,%esp
  802115:	5b                   	pop    %ebx
  802116:	5e                   	pop    %esi
  802117:	5f                   	pop    %edi
  802118:	5d                   	pop    %ebp
  802119:	c3                   	ret    
  80211a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802120:	0f bd fa             	bsr    %edx,%edi
  802123:	83 f7 1f             	xor    $0x1f,%edi
  802126:	75 48                	jne    802170 <__udivdi3+0xa0>
  802128:	39 f2                	cmp    %esi,%edx
  80212a:	72 06                	jb     802132 <__udivdi3+0x62>
  80212c:	31 c0                	xor    %eax,%eax
  80212e:	39 eb                	cmp    %ebp,%ebx
  802130:	77 de                	ja     802110 <__udivdi3+0x40>
  802132:	b8 01 00 00 00       	mov    $0x1,%eax
  802137:	eb d7                	jmp    802110 <__udivdi3+0x40>
  802139:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802140:	89 d9                	mov    %ebx,%ecx
  802142:	85 db                	test   %ebx,%ebx
  802144:	75 0b                	jne    802151 <__udivdi3+0x81>
  802146:	b8 01 00 00 00       	mov    $0x1,%eax
  80214b:	31 d2                	xor    %edx,%edx
  80214d:	f7 f3                	div    %ebx
  80214f:	89 c1                	mov    %eax,%ecx
  802151:	31 d2                	xor    %edx,%edx
  802153:	89 f0                	mov    %esi,%eax
  802155:	f7 f1                	div    %ecx
  802157:	89 c6                	mov    %eax,%esi
  802159:	89 e8                	mov    %ebp,%eax
  80215b:	89 f7                	mov    %esi,%edi
  80215d:	f7 f1                	div    %ecx
  80215f:	89 fa                	mov    %edi,%edx
  802161:	83 c4 1c             	add    $0x1c,%esp
  802164:	5b                   	pop    %ebx
  802165:	5e                   	pop    %esi
  802166:	5f                   	pop    %edi
  802167:	5d                   	pop    %ebp
  802168:	c3                   	ret    
  802169:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802170:	89 f9                	mov    %edi,%ecx
  802172:	b8 20 00 00 00       	mov    $0x20,%eax
  802177:	29 f8                	sub    %edi,%eax
  802179:	d3 e2                	shl    %cl,%edx
  80217b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80217f:	89 c1                	mov    %eax,%ecx
  802181:	89 da                	mov    %ebx,%edx
  802183:	d3 ea                	shr    %cl,%edx
  802185:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802189:	09 d1                	or     %edx,%ecx
  80218b:	89 f2                	mov    %esi,%edx
  80218d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802191:	89 f9                	mov    %edi,%ecx
  802193:	d3 e3                	shl    %cl,%ebx
  802195:	89 c1                	mov    %eax,%ecx
  802197:	d3 ea                	shr    %cl,%edx
  802199:	89 f9                	mov    %edi,%ecx
  80219b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80219f:	89 eb                	mov    %ebp,%ebx
  8021a1:	d3 e6                	shl    %cl,%esi
  8021a3:	89 c1                	mov    %eax,%ecx
  8021a5:	d3 eb                	shr    %cl,%ebx
  8021a7:	09 de                	or     %ebx,%esi
  8021a9:	89 f0                	mov    %esi,%eax
  8021ab:	f7 74 24 08          	divl   0x8(%esp)
  8021af:	89 d6                	mov    %edx,%esi
  8021b1:	89 c3                	mov    %eax,%ebx
  8021b3:	f7 64 24 0c          	mull   0xc(%esp)
  8021b7:	39 d6                	cmp    %edx,%esi
  8021b9:	72 15                	jb     8021d0 <__udivdi3+0x100>
  8021bb:	89 f9                	mov    %edi,%ecx
  8021bd:	d3 e5                	shl    %cl,%ebp
  8021bf:	39 c5                	cmp    %eax,%ebp
  8021c1:	73 04                	jae    8021c7 <__udivdi3+0xf7>
  8021c3:	39 d6                	cmp    %edx,%esi
  8021c5:	74 09                	je     8021d0 <__udivdi3+0x100>
  8021c7:	89 d8                	mov    %ebx,%eax
  8021c9:	31 ff                	xor    %edi,%edi
  8021cb:	e9 40 ff ff ff       	jmp    802110 <__udivdi3+0x40>
  8021d0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8021d3:	31 ff                	xor    %edi,%edi
  8021d5:	e9 36 ff ff ff       	jmp    802110 <__udivdi3+0x40>
  8021da:	66 90                	xchg   %ax,%ax
  8021dc:	66 90                	xchg   %ax,%ax
  8021de:	66 90                	xchg   %ax,%ax

008021e0 <__umoddi3>:
  8021e0:	f3 0f 1e fb          	endbr32 
  8021e4:	55                   	push   %ebp
  8021e5:	57                   	push   %edi
  8021e6:	56                   	push   %esi
  8021e7:	53                   	push   %ebx
  8021e8:	83 ec 1c             	sub    $0x1c,%esp
  8021eb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8021ef:	8b 74 24 30          	mov    0x30(%esp),%esi
  8021f3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8021f7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8021fb:	85 c0                	test   %eax,%eax
  8021fd:	75 19                	jne    802218 <__umoddi3+0x38>
  8021ff:	39 df                	cmp    %ebx,%edi
  802201:	76 5d                	jbe    802260 <__umoddi3+0x80>
  802203:	89 f0                	mov    %esi,%eax
  802205:	89 da                	mov    %ebx,%edx
  802207:	f7 f7                	div    %edi
  802209:	89 d0                	mov    %edx,%eax
  80220b:	31 d2                	xor    %edx,%edx
  80220d:	83 c4 1c             	add    $0x1c,%esp
  802210:	5b                   	pop    %ebx
  802211:	5e                   	pop    %esi
  802212:	5f                   	pop    %edi
  802213:	5d                   	pop    %ebp
  802214:	c3                   	ret    
  802215:	8d 76 00             	lea    0x0(%esi),%esi
  802218:	89 f2                	mov    %esi,%edx
  80221a:	39 d8                	cmp    %ebx,%eax
  80221c:	76 12                	jbe    802230 <__umoddi3+0x50>
  80221e:	89 f0                	mov    %esi,%eax
  802220:	89 da                	mov    %ebx,%edx
  802222:	83 c4 1c             	add    $0x1c,%esp
  802225:	5b                   	pop    %ebx
  802226:	5e                   	pop    %esi
  802227:	5f                   	pop    %edi
  802228:	5d                   	pop    %ebp
  802229:	c3                   	ret    
  80222a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802230:	0f bd e8             	bsr    %eax,%ebp
  802233:	83 f5 1f             	xor    $0x1f,%ebp
  802236:	75 50                	jne    802288 <__umoddi3+0xa8>
  802238:	39 d8                	cmp    %ebx,%eax
  80223a:	0f 82 e0 00 00 00    	jb     802320 <__umoddi3+0x140>
  802240:	89 d9                	mov    %ebx,%ecx
  802242:	39 f7                	cmp    %esi,%edi
  802244:	0f 86 d6 00 00 00    	jbe    802320 <__umoddi3+0x140>
  80224a:	89 d0                	mov    %edx,%eax
  80224c:	89 ca                	mov    %ecx,%edx
  80224e:	83 c4 1c             	add    $0x1c,%esp
  802251:	5b                   	pop    %ebx
  802252:	5e                   	pop    %esi
  802253:	5f                   	pop    %edi
  802254:	5d                   	pop    %ebp
  802255:	c3                   	ret    
  802256:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80225d:	8d 76 00             	lea    0x0(%esi),%esi
  802260:	89 fd                	mov    %edi,%ebp
  802262:	85 ff                	test   %edi,%edi
  802264:	75 0b                	jne    802271 <__umoddi3+0x91>
  802266:	b8 01 00 00 00       	mov    $0x1,%eax
  80226b:	31 d2                	xor    %edx,%edx
  80226d:	f7 f7                	div    %edi
  80226f:	89 c5                	mov    %eax,%ebp
  802271:	89 d8                	mov    %ebx,%eax
  802273:	31 d2                	xor    %edx,%edx
  802275:	f7 f5                	div    %ebp
  802277:	89 f0                	mov    %esi,%eax
  802279:	f7 f5                	div    %ebp
  80227b:	89 d0                	mov    %edx,%eax
  80227d:	31 d2                	xor    %edx,%edx
  80227f:	eb 8c                	jmp    80220d <__umoddi3+0x2d>
  802281:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802288:	89 e9                	mov    %ebp,%ecx
  80228a:	ba 20 00 00 00       	mov    $0x20,%edx
  80228f:	29 ea                	sub    %ebp,%edx
  802291:	d3 e0                	shl    %cl,%eax
  802293:	89 44 24 08          	mov    %eax,0x8(%esp)
  802297:	89 d1                	mov    %edx,%ecx
  802299:	89 f8                	mov    %edi,%eax
  80229b:	d3 e8                	shr    %cl,%eax
  80229d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022a1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8022a5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8022a9:	09 c1                	or     %eax,%ecx
  8022ab:	89 d8                	mov    %ebx,%eax
  8022ad:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022b1:	89 e9                	mov    %ebp,%ecx
  8022b3:	d3 e7                	shl    %cl,%edi
  8022b5:	89 d1                	mov    %edx,%ecx
  8022b7:	d3 e8                	shr    %cl,%eax
  8022b9:	89 e9                	mov    %ebp,%ecx
  8022bb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8022bf:	d3 e3                	shl    %cl,%ebx
  8022c1:	89 c7                	mov    %eax,%edi
  8022c3:	89 d1                	mov    %edx,%ecx
  8022c5:	89 f0                	mov    %esi,%eax
  8022c7:	d3 e8                	shr    %cl,%eax
  8022c9:	89 e9                	mov    %ebp,%ecx
  8022cb:	89 fa                	mov    %edi,%edx
  8022cd:	d3 e6                	shl    %cl,%esi
  8022cf:	09 d8                	or     %ebx,%eax
  8022d1:	f7 74 24 08          	divl   0x8(%esp)
  8022d5:	89 d1                	mov    %edx,%ecx
  8022d7:	89 f3                	mov    %esi,%ebx
  8022d9:	f7 64 24 0c          	mull   0xc(%esp)
  8022dd:	89 c6                	mov    %eax,%esi
  8022df:	89 d7                	mov    %edx,%edi
  8022e1:	39 d1                	cmp    %edx,%ecx
  8022e3:	72 06                	jb     8022eb <__umoddi3+0x10b>
  8022e5:	75 10                	jne    8022f7 <__umoddi3+0x117>
  8022e7:	39 c3                	cmp    %eax,%ebx
  8022e9:	73 0c                	jae    8022f7 <__umoddi3+0x117>
  8022eb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8022ef:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8022f3:	89 d7                	mov    %edx,%edi
  8022f5:	89 c6                	mov    %eax,%esi
  8022f7:	89 ca                	mov    %ecx,%edx
  8022f9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8022fe:	29 f3                	sub    %esi,%ebx
  802300:	19 fa                	sbb    %edi,%edx
  802302:	89 d0                	mov    %edx,%eax
  802304:	d3 e0                	shl    %cl,%eax
  802306:	89 e9                	mov    %ebp,%ecx
  802308:	d3 eb                	shr    %cl,%ebx
  80230a:	d3 ea                	shr    %cl,%edx
  80230c:	09 d8                	or     %ebx,%eax
  80230e:	83 c4 1c             	add    $0x1c,%esp
  802311:	5b                   	pop    %ebx
  802312:	5e                   	pop    %esi
  802313:	5f                   	pop    %edi
  802314:	5d                   	pop    %ebp
  802315:	c3                   	ret    
  802316:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80231d:	8d 76 00             	lea    0x0(%esi),%esi
  802320:	29 fe                	sub    %edi,%esi
  802322:	19 c3                	sbb    %eax,%ebx
  802324:	89 f2                	mov    %esi,%edx
  802326:	89 d9                	mov    %ebx,%ecx
  802328:	e9 1d ff ff ff       	jmp    80224a <__umoddi3+0x6a>
